# PlotlyJS reverse x-axis

**URL:** <https://discourse.julialang.org/t/plotlyjs-reverse-x-axis/24874>\
**Category:** General Usage\
**Created:** [June 3, 2019, 6:03am UTC](https://discourse.julialang.org/t/plotlyjs-reverse-x-axis/24874 "2019-06-03T06:03:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bernhard](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bernhard/32/2619_2.png) [@bernhard](https://discourse.julialang.org/u/bernhard)\
**Post date:** [June 3, 2019, 6:03am UTC](https://discourse.julialang.org/t/plotlyjs-reverse-x-axis/24874/1 "2019-06-03T06:03:39Z")

</div>

For a line plot (with one line, sorted data) there should be four “options”: both the data and the x-axis can be sorted from high to low and vice versa.

In the example below, I can easily reverse the ‘data’, but not the x-axis (it always starts at 0 in the bottom left corner).  
I tried out a few things with `xflip` and `attr(traceorder="reversed")`, but was not successful. What am I missing?

```julia
using PlotlyJS

nn=1000
simulated_data=rand(nn).^3
sort!(simulated_data)

probabilityAxis=ones(nn).-collect(1:nn)./nn

layout = Layout(;xflip=false) #,legend=attr(traceorder="reversed"))
data=scatter(x=probabilityAxis,y=simulated_data)
PlotlyJS.plot(data,layout)

#this works as expected
data=scatter(x=probabilityAxis,y=reverse(simulated_data))
PlotlyJS.plot(data,layout)

#this looks the same as the previous plot. Why?
data=scatter(x=reverse(probabilityAxis),y=simulated_data)
PlotlyJS.plot(data,layout)

```

---

<div class="post-metadata">

**Author:** ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)\
**Post date:** [June 3, 2019, 9:42am UTC](https://discourse.julialang.org/t/plotlyjs-reverse-x-axis/24874/2 "2019-06-03T09:42:34Z")

</div>

> [@bernhard](#):
>
> layout = Layout(;xflip=false)

layout = Layout(;xflip=false,xaxis\_autorange = “reversed”)
