我现在是Plotly的初学者,有一个我似乎无法解决的问题.我有我的阴谋堆积条形图,但我不知道如何为每个类别着色.我目前正在使用R.
我目前的代码是:
p = plot_ly(x, x = day, y = count, type = "bar", group = status) %>% layout(barmode = "stack", showlegend = T)
Run Code Online (Sandbox Code Playgroud)
我已经尝试使用"color = "
参数和标记,但没有正确的颜色我的图形.
我当前图形的悬停信息略有旋转(见下图).也就是说,当我将鼠标悬停在条形图上时,悬停文本会从水平方向旋转约60度(例如,请参见图像中的第二个条形图).如何将旋转设置为0?
# sample data
tbl = data.frame(list_id = c(1,2,3,4,5,1,2,3,4,5,1,2,3,4,5),
main_count = c(1,2,3,4,1,2,3,4,1,2,3,4,1,2,3),
total = c(23,34,66,22,66,88,55,44,22,11,33,55,43,22,55))
plot_ly(tbl, type = "bar",
y = main_count, x = total, group = list_id, orientation = "h") %>%
layout(xaxis = list(title = ""), barmode = "stack")
Run Code Online (Sandbox Code Playgroud)