I have a graph with a horizontal axis:
How can I make the axis vertical so it can be more readable?
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
df = pd.read_csv("cb_pb.csv", index_col=0)
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
app.layout = html.Div([
html.Div([
dcc.Graph(id='the_graph')
])
])
@app.callback(
Output(component_id='the_graph', component_property='figure'),
[Input(component_id="perfume-dropdown", component_property="value")]
)
def update_graph(my_dropdown):
dfc = df.sort_values(by='perceived_benefit', ascending=False)
traces = []
for i in range(len(dfc)):
if dfc.iloc[i].name == my_dropdown:
trace_claimed = go.Bar(x=[dfc.iloc[i].values[0]], y=[dfc.iloc[i].values[2]], name='Claimed')
trace_perceived = go.Bar(x=[dfc.iloc[i].values[0]], y=[-dfc.iloc[i].values[1]], name='Perceived')
traces.append(trace_claimed)
traces.append(trace_perceived)
figure={
'data': traces,
'layout':
go.Layout(title='Score des parfums sur les attributs', barmode='stack')
}
return figure