Can Dash support horizontal bar

There is a horizontal bar graph in plotly. But I can’t find any example to use it in Dash
Can Dash support horizontal bar?

Yes.

All you have to do is supply a orientation='h' argument.
Also make sure that your x and y axes are in the proper place, for example:

import dash
import dash_html_components as html
import dash_core_components as dcc
import plotly.graph_objs as go

app = dash.Dash()

app.layout = html.Div([
    dcc.Graph(id='a_graph',
              figure={
        'data': [go.Bar(x=[1, 2, 3], 
                        y=['A', 'B', 'C'],
                        orientation='h')]
    })
])

if __name__ == '__main__':
    app.run_server()
2 Likes