I have a column called Brand and another called Model, I would like to show the top 5 or 10 brands automatically without manually entering based on the total number of models per brand.
My code is;
labels = [ 'Audi','Nissan', 'Tesla','Volkswagen','Skoda']
values = [9,8,13,8,6]
fig = go.Figure(data=[go.Pie(labels=labels,
values=values,
title="Top 5 Manufacturers with Most Vehicles",
titleposition='top left',
pull=[0, 0, 0.2, 0])])
fig.update_layout(
font=dict(
family="Times New Roman",
size=20,
color='black',
))
fig.update_traces(textfont_size=18)
fig.update_layout(height=535,
width=1150,
margin=dict(t=0, b=0, l=0, r=0),
font=dict(size=18),
title=dict(
y=1,
x=0.5,
xanchor= 'left',
yanchor= 'top'),
legend=dict(
orientation="h",
yanchor="bottom",
y=0.01,
xanchor="right",
x=0.95))
fig.show()
Many thanks