rplotlyradar-chartspider-chart

Plotly Radar Chart from ”circle” to polygon


I would like to create a radar chart using plotly but I want the plot to have sides on the chart instead of being a circle.

I'm using the example from the plotly website.

The default output looks like this: Figure 1: Standard output

I would like something like this: Figure 2: Expected Output

My code:

library(plotly)

fig <- plot_ly(
  type = 'scatterpolar',
  r = c(39, 28, 8, 7, 28, 39),
  theta = c('A','B','C', 'D', 'E', 'A'),
  fill = 'toself'
  )

fig <- fig %>%
  layout(
    polar = list(
      radialaxis = list(
        visible = T,
        range = c(0,50)
      )
    ),
    showlegend = F
  )

fig

Solution

  • Adding gridshape = 'linear' to layout() worked for me.