✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🐇 Announcing Dash VTK for 3d simulation graphics. Check out the March webinar.

How to modify some features in a radial bar polar chart created by plotly in R?

Hello,
I have a two-column data as below that I really need to create a quarter circle bar polar chart similar to the attached image (a quarter circle bar polar plot from zero to 90 degree). polar bar

Angle   Frequency   
0-10     83.3
10_20   26.6
20_30   15.7
30_40   62.3
40_50   32.4

I tried using plotly in R as below:

library("plotly")
p <- plot_ly(
  type = 'barpolar',
  r = c(83.3, 26.6, 15.7, 62.3, 32.4),
  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 circular bar polar chart using plotly , and I could not find how to modify them.

Here are my questions:

  1. How do I modify the interval of the bins? In my current chart, angles are divided into 15 degree increments: 0, 15, 30, 45, 60, 75, and 90 degrees. I need to change this interval to 10 and make the divisions 0, 10, 20, 30, 40, 50, 60, 70, 80, and 90. How can I do that?

  2. How to set an interval of two theta for one individual frequency (as shown in my dataset)? For example, in the plot, I want to show the frequency of 83.3 for a theta interval of zero to 10; frequency of 26.6 for a theta interval of 10 to 20, …, and frequency of 32.4 for a theta interval of 40 to 50. How to do that?

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

I am really stuck in fixing these features, and highly need your valuable help. I would highly appreciate your great advice and help. Many thanks.