How to show only the top 5 values in bar chart using Plotly
import plotly.graph_objects as go
fig = go.Figure([go.Bar(x=col, y=res, text=res)])
fig.update_layout(plot_bgcolor = "white",
font = dict(color = "#909497"),
title = dict(text = "Ratio of Buyers vs Non Buyers (Master Data(MIN))"),
xaxis = dict(title = "Features", linecolor = "#909497"), #tick prefix is the html code for Rupee
yaxis = dict(title = "Ratio", tickformat = ",", linecolor = "#909497",)) #apply our custom category order
fig.update_layout(barmode='stack', xaxis={'categoryorder':'total descending'})
fig.show()