我试图使用Plotly包将xlab垂直放入绘图中。我想和" las = 2"做同样的事情。在标准R.
我发现' tickangle = 45'但它适用于刻度,而不适用于标签。
任何人都可以帮助我?
` plot_ly(x = account$country,
opacity = 0.6,
type = "histogram",
histnorm = "probability",
color = c('More than One account'),
colors = 'red') %>%
add_trace(x = account2$country,
opacity = 0.6,
type = "histogram",
histnorm = "probability",
color = c('Account'),
colors='blue') %>%
layout(barmode="overlay",
title = "Clients test",
xaxis = list(title = "Country", color ="red"),
yaxis = list(title = "Clients"))
`
谢谢。
答案 0 :(得分:6)
在您的情况下,您可以在xaxis中添加tickangle:
layout(barmode="overlay",
title = "Clients test",
xaxis = list(title = "Country", color ="red", tickangle = 90),
yaxis = list(title = "Clients"))