我有下面的雷达图的代码,这些代码是在R中的plotly包中创建的。直线从点到点是笔直的,但我想使其弯曲。我正在尝试阅读文档,以进行详细说明,但难以解释。
这是我的代码:
fig <- plot_ly(
type = 'scatterpolar',
r = c(1,3,2,4,1),
theta = c("A","B","C","D","E"),
fill = 'toself',
line = list(c(shape = "spline"))
)
fig %>%
layout(
polar = list(
radialaxis = list(
visible = T,
range = c(0,4)
)
),
showlegend = F
)
我希望这些点处的线弯曲。
没有必要将形状调用封装为矢量。
fig <- plot_ly(
type = 'scatterpolar',
mode = "markers",
r = c(1,3,2,4,1, 1),
theta = c("A","B","C","D","E", "A"),
fill = 'toself',
line = list(shape = 'spline')
)
fig %>%
layout(
polar = list(
radialaxis = list(
visible = T,
range = c(0,4)
)
),
showlegend = F
)
P.S .:我已在输入向量的末尾添加了输入向量的第一个值,以连接末端。