繁体   English   中英

r 方面数据的散点图顺时针轴

[英]r scatterpolar plot for aspect data plotly clockwise axis

我正在使用 plotly 在 r 中制作散点极坐标图,以根据风速绘制站点方面。

有没有办法改变轴,所以 0 度仍然在顶部,但 90 度在轴的 3 点钟位置? 我还想在图中添加罗盘方向标签(N、E、S、W)

这是我使用的代码和我到目前为止所做的情节:

library(plotly)

plot_ly(type='scatterpolar',r=dat$y,theta=dat$x,mode='markers')

阴谋

您可以在 plotly layout使用angularaxis来指示角度方向(顺时针)、初始旋转,并为标签添加刻度文本字母。

dat <- data.frame(
  x=sample(1000),
  y=sample(1000)
)

library(magrittr)
library(plotly)

plot_ly(type='scatterpolar',r=dat$y,theta=dat$x,mode='markers') %>%
  layout(
    polar = list(
      angularaxis = list(
        rotation = 90,
        direction = 'clockwise',
        tickvals = seq(0,359,90),
        ticktext = c("N", "E", "S", "W")
      )
    )
  )

阴谋

散点图示例

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM