我在x轴上创建了一个带有日期的绘图条形图,但是刻度与实际日期不匹配.
df <- data.frame(
Dates = c("2017-05-01", "2017-05-02", "2017-05-03", "2017-05-04")
,Values = c(22, 44, 66, 88)
,stringsAsFactors = FALSE
)
df$Dates <- as.Date(df$Dates)
plot_ly(
data = df, x = ~Dates, y = ~Values
,type = "bar"
)
sessionInfo()
R version 3.3.1 (2016-06-21)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.12.2 (Sierra)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods
[7] base
other attached packages:
[1] plotly_4.5.2 ggplot2_2.2.0
loaded via a namespace (and not attached):
[1] …Run Code Online (Sandbox Code Playgroud)