Hello,
I’m trying to reproduce in Plotly a chart that I made using matplotlib since I would like to make it interactive and potentially make use of other features that Plotly has to offer.
I have a couple of questions:
- Is there a way to adjust the radius for each slice separately? I know this is possible in Matplotlib but I haven’t found a way to do the same in Plotly.
- Is there a proper way to overlay multiple charts, basically placing one chart over another but of different sizes? In the code example below I’ve attempted to do so but haven’t quite got the hang of it.
- Also, is there any way to use a continuous colormap/scale applied to a piechart? So far I’ve only seen the option of using discrete. Pie documentation
- Is it possible to turn a slice/wedge invisible but without changing positions? I’ve seen this example but I would like that the piechart doesn’t change its shape, I would like the location of the invisible slice to be left as it is. I found some example but it’s not what I want: Is there a way to hide some slices by default in a pie chart?
import plotly.graph_objs as go
df = pd.read_csv('animation/data/factors_df_2022-03-09_06-00-06-30.csv', index_col=0)
# change index to string
df.index = df.index.map(str)
names = ['Null', 'Pred=-1', 'Pred=0', 'Other', 'R_min'] + df.index[5:].tolist()
trace0 = go.Pie(
values=df['sum_cnt'], labels=names, opacity=0.5)
trace1 = go.Pie(
values=df['sum_cnt'], marker_colors=px.colors.sequential.Sunset,
textinfo='none',
hoverinfo='none',
domain={'x': [0.33, 0.66], 'y': [0.0, 0.6]})
data = [trace0,trace1]
layout = go.Layout(title="FPP chart",
)
fig = go.Figure(data=data, layout=layout, layout_showlegend=False)
fig.show()
I’m not fixated on using a piechart if there are other ways however, essentially what I did in matplotlib was using Pie class.