How to modify bin interval and bars colour in a bar polar chart created by plotly package in R?
0
1
Entering edit mode
4.3 years ago
Farah ▴ 80

Hello,

I am trying to make a bar polar chart for spindle orientation in a quarter circle shape. My data has two columns, "Angle" and "Percentage". I used plotly package in R and the below codes to make it:

library("plotly")
p <- plot_ly(
  type = 'barpolar',
  r = c(54.7, 32.6, 8.4, 10.4, 30.6),
  theta = c(0, 10, 20, 30, 40)) %>% 
    layout(
    polar = list(
      radialaxis = list(
        visible = T,
        range = c(0,60)
      ),
      sector = c(0,90),
      radialaxis = list(
        tickfont = list(
          size = 10
        )
      ),
      angularaxis = list(
        tickfont = list(
          size = 10
        )
      )
    )
)

However, I need to change some features of the created bar polar chart. I searched a lot but I could find how to modify them. May I kindly ask you to help me in my below questions:

1) How to modify the interval of bins? I mean, in my current chart, angles are divided to 0, 15, 30, 45, 60, 75, and 90 degrees. The interval of each bin is 15 degree. But, I need to change this interval to 10 and make the angle divisions to 0, 10, 20, 30, 40, 50, 60, 70, 80, and 90. How can I do that?

2) How can I change the colour of bars? Now all five bars are blue, but I want to change the blue colour, for example, to black, red, or any colour.

I would highly appreciate your great and valuable help. Best wishes.

plotly R bar_polar_chart Radial_histogram • 1.9k views
ADD COMMENT

Login before adding your answer.

Traffic: 2294 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6