BarPolar with Overlay - Disable zoom feature #4544

Hi @mdineshari welcome to the forum! In the future if you have several questions could you please write one post per question? It makes it easier for other users to search for information.

Regarding 1., one way to disable zoom is to set layout.dragmode: false (see Disable zoom but keep click enabled)

For 2, for setting the color of each bar you could adapt this example https://plot.ly/python/polar-chart/#polar-bar-chart from the Python doc which translates readily into Javascript.

For 3, the Barpolar trace does not have an attribute to display text but you could add a scatter trace with the same points which can be used to display text. Below is a Python example because Iā€™m less fluent with Javascript but you can adapt it to Javascript.

import plotly.graph_objects as go
import numpy as np

r = np.array([3.5, 1.5, 2.5, 4.5, 4.5, 4, 3])

fig = go.Figure(go.Barpolar(
    r=r,
    theta=[65, 15, 210, 110, 312.5, 180, 270],
    width=[20,15,10,20,15,30,15,],
    marker_color=["#E4FF87", '#709BFF', '#709BFF', '#FFAA70', '#FFAA70', '#FFDF70', '#B6FFB4'],
    marker_line_color="black",
    marker_line_width=2,
    opacity=0.8,
    text=[1, 2, 3, 4, 5, 6, 7]
))
fig.add_trace(go.Scatterpolar(
    r=r + 0.2,
    theta=[65, 15, 210, 110, 312.5, 180, 270],
    text=[1, 2, 3, 4, 5, 6, 7],
    mode='text'
))

fig.update_layout(
    template=None,
    polar = dict(
        radialaxis = dict(range=[0, 5], showticklabels=False, ticks=''),
        angularaxis = dict(showticklabels=False, ticks='')
    ),
    dragmode=False 
)

fig.show()

Happy plotting :wink:

1 Like