Black Lives Matter. Please consider donating to Black Girls Code today.

Mirror axis lines, ticks and data


I’m trying to mirror the yaxis ticks and the data in a horizontal bar. I’m using the “mirror” attribute to do it with the following values:

layout = go.Layout(
    yaxis={"mirror" : "all", 'side': 'right'}  

but it only mirror the axis line and the ticks. Is it possible to mirror the data?

I basically want to convert this:

In this (in a right way):


Hi @dmedina,

You can flip the direction of the x-axis by specifying a range extents in version order. e.g.

    'data': [{'orientation': 'h',
              'type': 'bar',
              'x': [5, 7, 21, 35, 4],
              'y': ['a', 'b', 'c', 'd', 'e']}],
    'layout': {'xaxis': {'range': [40, 0], 'side': 'top'},
               'yaxis': {'side': 'right'}}

Hope that helps!

1 Like

That works! Thank you for the answer and for taking the time, I really appreciate it.