I am trying to plot a radarplot with a scale of 0 -3 in .5 increments, and then teh plot area between 0 and.5 white, .5 to 1 green, 1 - 2 yellow and 2 -3 Red but cannot find a way to color the graph radials between those values a specific color. Iβd appreciate being pointed to any documentation on how to do this.
Welcome @jlc !
Could you provide some sample code?
Sure. Here is a snippet. Iβd like to color the radial area between 0-1 green, 1- 2 yellow, and 2 - 3 red.. Sort of like. bullseye with the plot overlaying the colors.
fig = go.Figure(data=go.Scatterpolar(
r = values,
theta = titles,
mode = 'lines+markers',
line_color="black",
marker= dict(
color = colors,
size = 10,
),
))
fig.update_layout(
title = 'Project',
polar=dict(
radialaxis=dict(
visible=True,
range=[0, 3],
),
angularaxis=dict(
rotation=90, # Rotates the axis 90 degrees counterclockwise
direction="clockwise"
)
),
showlegend=False,
height = 600,
)
plot_div = pyo.plot(fig, output_type='div')
.
Hello @jlc ,
A quick & dirty solution might be overlaying a barpolar plot. You would need to tweak the axes and hoverinfo.
import plotly.graph_objects as go
import numpy as np
values = np.ones(4)
radius = np.arange(4)
fig = go.Figure(
data=go.Scatterpolar(
r = radius,
mode = 'lines+markers',
line_color="black"
)
)
fig.update_layout(
title = 'Project',
polar=dict(
radialaxis=dict(
visible=True,
range=[0, 5],
),
angularaxis=dict(
rotation=90, # Rotates the axis 90 degrees counterclockwise
direction="clockwise"
)
),
showlegend=False,
height = 600
)
for i, color in enumerate(["red", "green", "yellow"], start=1):
fig.add_trace(
go.Barpolar(
r=values * i,
marker_color=color
)
)
fig.update_layout(polar_bargap=0)
fig.update_traces(dict(marker=dict(line=dict(width=0, color="rgba(255,0,0,0)"))))
fig.show()
Thanks. Iβll play around with it but looking at the colors itβs likely to be too garish, even muted so Iβll probably stick to just coloring the markers on a grey background
1 Like