【问题标题】:r scatterpolar plot for aspect data plotly clockwise axisr scatterpolar plot for aspect data plotly 顺时针轴
【发布时间】:2021-01-05 07:20:46
【问题描述】:

我正在使用 plotly 在 r 中制作一个散点极坐标图,以绘制场地方面与风速的关系。

有没有办法改变轴,使 0 度仍然在顶部,但 90 度在轴上的 3 点钟位置?我还想将指南针方向标签 (N,E,S,W) 添加到绘图中

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

library(plotly)

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

plot

【问题讨论】:

    标签: r plot axis


    【解决方案1】:

    您可以在情节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")
          )
        )
      )
    

    情节

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-04-08
      • 2017-09-18
      • 2016-01-10
      • 2021-12-11
      • 1970-01-01
      • 2021-12-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多