plotly.py icon indicating copy to clipboard operation
plotly.py copied to clipboard

Polar barplots do not have reset zoom available

Open stephantamminga opened this issue 3 years ago • 0 comments

I'm creating polar barplots to visualize angular histograms. These plots do have a zoom option in the modebar, but not a resetScale or zoomout. So I can zoom in, but there is no way to zoom out again.

Trying to add these buttons explicitly doesn't work. The modebar_add function does not throw an error, but no buttons are added either.

import plotly.graph_objects as go
import numpy as np

fig = go.Figure()

bins = np.linspace(0,358,180)
arr = np.array(bins)

series = [90+20*np.random.normal() for _ in np.arange(100)]

count, division = np.histogram(series, bins=bins)

fig.add_trace(go.Barpolar(
    r=count,
    theta=series,
    width=1,
    marker_line_width=2,
    opacity=0.5,
    base=0
))

fig.update_layout(
    title='Polar histogram',
    width=1000,
    height=1000,
    template=None,
    polar = dict(
        angularaxis = dict(showticklabels=True,
                           ticks='',
                           ),
    ),
    modebar_add=['resetScale',
                 'zoomout'],
)


fig.show()

stephantamminga avatar Sep 14 '22 08:09 stephantamminga