# How can you reverse an axis and set its range at the same time?

**URL:** https://community.plotly.com/t/how-can-you-reverse-an-axis-and-set-its-range-at-the-same-time/44121
**Category:** 📊 Plotly Python
**Created:** [August 24, 2020, 8:10am UTC](https://community.plotly.com/t/how-can-you-reverse-an-axis-and-set-its-range-at-the-same-time/44121 "2020-08-24T08:10:21Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Kansai](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/kansai/32/32618_2.png) [@Kansai](https://community.plotly.com/u/Kansai)
#### Post date: [August 24, 2020, 8:10am UTC](https://community.plotly.com/t/how-can-you-reverse-an-axis-and-set-its-range-at-the-same-time/44121/1 "2020-08-24T08:10:21Z")

</div>

I need a plot in which my Y axis is reversed. However I _also_ need to be able to set its range.  
Using autorange reverse do reverse my axis but cannot set the range anymore.

How can I do this?

```auto
layout1= go.Layout(title=go.layout.Title(text="A graph",x=0.5),
        xaxis={'title':'y[m]','autorange':'reversed','range':[-10,10]},
        yaxis={'title':'x[m]', 'side':'right'})

# switch the x- and y-coordinates

point_plot=[

            go.Scatter(y=[3],x=[1],name="V0"),
            go.Scatter(y=[5],x=[2],name="GT"),
            go.Scatter(y=[0],x=[0],name="egoCar")

    ]

fig = go.Figure(data=point_plot, layout=layout1)

# reverse the range of the xaxis (which contains the y values)
#fig.update_xaxes(autorange="reversed")
fig.show()

```

Right now the Y axis is from 0 to 2 not -10,10

---

<div class="post-metadata">

### Author: ![prabukailasah](https://avatars.discourse-cdn.com/v4/letter/p/7c8e57/32.png) [@prabukailasah](https://community.plotly.com/u/prabukailasah)
#### Post date: [January 26, 2022, 2:12pm UTC](https://community.plotly.com/t/how-can-you-reverse-an-axis-and-set-its-range-at-the-same-time/44121/2 "2022-01-26T14:12:40Z")

</div>

hi Kansai, were you able to resolve this issue, I happened to run the same issue still no luck, could you please share the ideas? thanks in advance!

---

<div class="post-metadata">

### Author: ![alexcjohnson](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/alexcjohnson/32/614_2.png) [@alexcjohnson](https://community.plotly.com/u/alexcjohnson)
#### Post date: [April 13, 2023, 8:51pm UTC](https://community.plotly.com/t/how-can-you-reverse-an-axis-and-set-its-range-at-the-same-time/44121/3 "2023-04-13T20:51:43Z")

</div>

Super old question, but I just came across it via a google search so I might as well add an answer…  
Set a range `[max, min]` instead of `[min, max]` and it will be reversed.
