【发布时间】:2019-10-15 03:38:15
【问题描述】:
我在下面有一个简单的数据框d,我想根据其值的频率创建一个直方图。我试图将初始值设置为0,然后通过5 在x 轴上显示这些值,但这些值似乎都不起作用,因为值从1 开始,然后显示8。我更希望有一个明确的情节解决方案作为首选,没有ggplot() 干扰。
d<-data.frame(c(1,5,7,5,4,5,6,7,8,9,10,15,13))
x <- list(
tick0=0,
dtick=5
)
# Create the plotly histogram
plot_ly(alpha = 0.9) %>%
add_histogram(x = as.factor(d[,1]),source="subset") %>%
# Add titles in plot and axes
layout(barmode = "overlay",xaxis=x,margin=list(b=100))
【问题讨论】: