Barpolar - is it possible to change radialaxis line style?

I’m trying to change the line style for a chart I’ve been working on.

The chart looks something like this:
image

I added some arrows to make sure my point gets through. In the documentation, I haven’t found a way to turn the line into dash, change it’s color and so on. Is it possible?

In the documentation I read that for a scatterpolar it’s possible to adjust this using line_dash which sets the dash style of lines Scatterpolar traces in Python

Is there a similar option for Barpolar as well? Or some other way?

Thanks!

Hi @geosphere

I tried to play around with a few barpolar plots but I don’t think what you’re trying to do is possible. You’re right that it’s possible with the scatterpolar plots, but there is nothing on dashed lines in the barpolar documentation.

@adamschroeder, thank you for taking the time to look into this.
I see/ Do you have any idea if such a feature is planned for the near future?

I don’t think so @geosphere . Not for the near future, at least.

@geosphere @adamschroeder
The style for the line, @geosphere pointed out, is not set as a go.Barpolar property.
It should be set in the polar layout.

By javascript and python reference for plotly.js, respectively plotly.py, there is a radialaxis attribute, griddash:
Layout.polar in JavaScript,
Layout.polar in Python
But a layout update:

fig.update_polars(radialaxis_griddash='dash')

throws the error:

ValueError: Invalid property specified for object of type plotly.graph_objs.layout.polar.RadialAxis: 'griddash'

On the other hand the PlotlyJS.jl (the Julia version of plotly.py) doesn’t throw any error (because it doesn’t check the attribute name),
and displays the radialaxis with the default solid line.
This means that plotly.js changes the griddash="dash", read from the figure json file to griddash="solid".
I opened an issue related to this behaviour on plotly js In polar layout the griddash attribute for radialaxis/angularaxis (listed in reference) is not accepted/active · Issue #6186 · plotly/plotly.js · GitHub

1 Like

@geosphere @adamschroeder
radialaxis_griddash=“dash” (or “dot”, etc) is active in Plotly version 5.8.0 (the last one)

fig = go.Figure(go.Barpolar(
                    r=[3.5, 1.5, 2.5, 4.5, 4.5, 4, 3],
                    theta=[65, 15, 210, 110, 312.5, 180, 270],
                    width=[20,15,10,20,15,30,15,],
                    marker_color="#ff8c00",
                    marker_line_color="black",
                    marker_line_width=1))

fig.update_layout(
    template=None,
    polar = dict(
        radialaxis = dict(range=[0, 5], showticklabels=False, ticks='', griddash='dash'),
        angularaxis = dict(showticklabels=False, ticks='')
    )
)
You also can set gridwidth, gridcolor for both radial and angular axis.

It looks better with dotted radialaxis:

 radialaxis = dict(range=[0, 5], showticklabels=False, ticks='', griddash='dot', gridcolor="black", gridwidth=2)

2 Likes

Thank you @empet. This is very helpful.

Thank you so much @empet.
By any chance, is there a way to set radialaxis to different styles? E.g. one is ‘dash’, another ‘dot’, another is ‘long dashed’ ?

No! Only a single line style is admitted.

Thank you!