【发布时间】:2019-04-15 09:10:12
【问题描述】:
比方说,我有一个简单的polar chart:
R 代码:
library(plotly)
p <- plot_ly(
type = 'scatterpolar',
r = c(0,1,2,4),
theta = c(0,45,90,120),
size = c(10, 20, 30, 40),
sizes = c(100, 300),
mode = 'markers'
) %>%
layout(
showlegend = FALSE,
polar = list(
angularaxis = list(
showticklabels = TRUE#,
#tickmode="array",
#tickvals = c(22.5, 67.5, 112, 157.5, 202, 247.5, 292, 337.5),
#ticktext = c('A', "B", "C", "D", "E", "F", "G", "H")
),
radialaxis = list(
tickmode="array",
tickvals = c(0, 1, 2, 3, 4, 5, 6, 7),
ticktext = c('', "One", "Two", "Three", "Four", "Five", "Six", "Seven")
)
)
)
ggplotly(p)
当我设置showticklabels = FALSE时,角度刻度标签消失了,然后我想把A,B,C,D,E,F,G and H放在角度c(22.5, 67.5, 112, 157.5, 202, 247.5, 292, 337.5)上。
我无法使用ticktexts 和tickvals 获得以下预期的情节。
有人可以帮我找到解决方案吗,或者add_text 或add_annotation 是否可行?
预期情节:
【问题讨论】:
标签: r ggplot2 r-plotly polar-coordinates