【发布时间】:2016-11-14 14:21:57
【问题描述】:
所以我在 Shiny 中使用 Plotly 创建条形图。但是 x 标签不是唯一的,例如(Dog 两次):
设 df 为:
x y
1 Dog
2 Cat
3 Dog
3 Ant
4 Bee
我希望绘制所有行,但这不起作用,因为 x 列中有重复的变量 Dog:
p = plot_ly(df, x = df[,2], y = df[,1], type = "bar", marker = list(color = toRGB("blue")))
p
所以我正在考虑通过以下方式解决这个问题: 我可以通过删除 x 参数来绘制所有 5 行。然后我希望能够分别修改这些名称来填写x列变量。
p = plot_ly(df, y = x, type = "bar", marker = list(color = toRGB("blue")))
p
如何手动更改 plotly barplot 中的 x 标签?
谢谢
【问题讨论】:
标签: r label shiny bar-chart plotly