# 3d Plots - change axis intersection // inverse axis

**URL:** <https://discourse.julialang.org/t/3d-plots-change-axis-intersection-inverse-axis/51109>\
**Category:** New to Julia\
**Tags:** plotting, plots, 3d\
**Created:** [December 2, 2020, 11:59am UTC](https://discourse.julialang.org/t/3d-plots-change-axis-intersection-inverse-axis/51109 "2020-12-02T11:59:23Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![neo\_abs](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/neo_abs/32/16672_2.png) [@neo\_abs](https://discourse.julialang.org/u/neo_abs)\
**Post date:** [December 2, 2020, 11:59am UTC](https://discourse.julialang.org/t/3d-plots-change-axis-intersection-inverse-axis/51109/1 "2020-12-02T11:59:23Z")

</div>

I have a 3d plot:

```julia
using Plots

x = [0,0,0,1,1,1,2,2,2]
y=[0,1,2,0,1,2,0,1,2]
z = 10*rand(9) .+ 2*collect(1:9)

plot(x,y,z, st=:surface,camera = (60,15))

```

axes intersect at:

How can I change it so:  
z and y on min z and max y. y and x at min y and min z

```julia
plot(x,y,z, st=:surface,camera = (60,15), yflip = true)

```

flips whole graph, not just axis, while axes are connected at the same points.

---

<div class="post-metadata">

**Author:** ![briochemc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/briochemc/32/4209_2.png) [@briochemc](https://discourse.julialang.org/u/briochemc)\
**Post date:** [December 2, 2020, 12:28pm UTC](https://discourse.julialang.org/t/3d-plots-change-axis-intersection-inverse-axis/51109/2 "2020-12-02T12:28:37Z")

</div>

I’m not sure what you are trying to do, but I think you want to rotate the plot more, so that the axes go behind the plot. Just playing around in Pluto, I found that the plot would not update angles beyond `(0, 90)`. In the GIF below, I tried pushing the angle to `-10` or `100`:

![Dec-02-2020 23-24-36](https://global.discourse-cdn.com/julialang/original/3X/7/e/7e12c59ff4c9319b158a4086db42889f801afcab.gif)

Is that your issue?

---

<div class="post-metadata">

**Author:** ![neo\_abs](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/neo_abs/32/16672_2.png) [@neo\_abs](https://discourse.julialang.org/u/neo_abs)\
**Post date:** [December 2, 2020, 12:48pm UTC](https://discourse.julialang.org/t/3d-plots-change-axis-intersection-inverse-axis/51109/3 "2020-12-02T12:48:00Z")

</div>

Nope, I want to inverse Y axis:  
YZ intersection would be (z = 0, y = 2)  
YX intersection would be (y = 0, x = 0)

---

<div class="post-metadata">

**Author:** ![briochemc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/briochemc/32/4209_2.png) [@briochemc](https://discourse.julialang.org/u/briochemc)\
**Post date:** [December 2, 2020, 1:06pm UTC](https://discourse.julialang.org/t/3d-plots-change-axis-intersection-inverse-axis/51109/4 "2020-12-02T13:06:20Z")

</div>

You want to change the origin of the axes?

---

<div class="post-metadata">

**Author:** ![neo\_abs](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/neo_abs/32/16672_2.png) [@neo\_abs](https://discourse.julialang.org/u/neo_abs)\
**Post date:** [December 2, 2020, 1:14pm UTC](https://discourse.julialang.org/t/3d-plots-change-axis-intersection-inverse-axis/51109/5 "2020-12-02T13:14:02Z")

</div>

Yes. Specifically of Y axis

---

<div class="post-metadata">

**Author:** ![briochemc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/briochemc/32/4209_2.png) [@briochemc](https://discourse.julialang.org/u/briochemc)\
**Post date:** [December 2, 2020, 1:26pm UTC](https://discourse.julialang.org/t/3d-plots-change-axis-intersection-inverse-axis/51109/6 "2020-12-02T13:26:09Z")

</div>

So you want the axes to _ **not** _ intersect at the same point?

---

<div class="post-metadata">

**Author:** ![neo\_abs](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/neo_abs/32/16672_2.png) [@neo\_abs](https://discourse.julialang.org/u/neo_abs)\
**Post date:** [December 2, 2020, 1:30pm UTC](https://discourse.julialang.org/t/3d-plots-change-axis-intersection-inverse-axis/51109/7 "2020-12-02T13:30:47Z")

</div>

![image](https://global.discourse-cdn.com/julialang/original/3X/1/2/121f57c6374d53135d3954b9719767a2f48a70ea.png)

I want Y and X have origin in the same point (0,0,min(z))

---

<div class="post-metadata">

**Author:** ![briochemc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/briochemc/32/4209_2.png) [@briochemc](https://discourse.julialang.org/u/briochemc)\
**Post date:** [December 2, 2020, 1:37pm UTC](https://discourse.julialang.org/t/3d-plots-change-axis-intersection-inverse-axis/51109/8 "2020-12-02T13:37:43Z")

</div>

Oh I see now! A nice scketch is worth a thousand words! Not sure you can do that if `yflip` does not work. have you tried flipping your data and the tick labels manually?

---

<div class="post-metadata">

**Author:** ![neo\_abs](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/neo_abs/32/16672_2.png) [@neo\_abs](https://discourse.julialang.org/u/neo_abs)\
**Post date:** [December 2, 2020, 1:43pm UTC](https://discourse.julialang.org/t/3d-plots-change-axis-intersection-inverse-axis/51109/9 "2020-12-02T13:43:08Z")

</div>

I could make data negative, and make ticks as strings (without minus). But this must be simplier.

---

<div class="post-metadata">

**Author:** ![neo\_abs](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/neo_abs/32/16672_2.png) [@neo\_abs](https://discourse.julialang.org/u/neo_abs)\
**Post date:** [December 2, 2020, 1:56pm UTC](https://discourse.julialang.org/t/3d-plots-change-axis-intersection-inverse-axis/51109/10 "2020-12-02T13:56:08Z")

</div>

```julia
x =- [0,0,0,1,1,1,2,2,2]
y= [0,1,2,0,1,2,0,1,2]
z = 10*rand(9) .+ 2*collect(1:9)

plot(x,y,z, st=:surface,camera = (85,15),xticks = ([-2,-1,0], [2,1,0]) )

```

This works, but I am disappointed.

---

<div class="post-metadata">

**Author:** ![mcmuffin6o](https://avatars.discourse-cdn.com/v4/letter/m/9f8e36/32.png) [@mcmuffin6o](https://discourse.julialang.org/u/mcmuffin6o)\
**Post date:** [December 1, 2023, 5:59am UTC](https://discourse.julialang.org/t/3d-plots-change-axis-intersection-inverse-axis/51109/11 "2023-12-01T05:59:02Z")

</div>

How does one open a feature request? Without the ability to change where axes intersect, Julia decides that I don’t need to see the axes:

 ![p3_tfc_soln](https://global.discourse-cdn.com/julialang/original/3X/6/a/6ae29c72ed0bb2b56ed8b494abc2c19dcd7729a4.png)  
and after adding `camera=(-45, atand(1 / √2))`:  
 ![p3_tfc_soln](https://global.discourse-cdn.com/julialang/original/3X/d/7/d79cfdf37311d0702d38cfeeaaa998e015c07627.png)

Edit: Came up with a hack

```julia
function rotate_negative_45_degrees!(surface_plot)
    # The GR backend cannot properly display the axes if you decide to rotate
    # the camera -45 degrees. This wouldn't be so bad if it had a way of
    # manually setting the spine positions a la matplotlib, but it doesn't.

    # Swap the axis labels
    temp = surface_plot[1][:xaxis][:guide]
    xlabel!(surface_plot, surface_plot[1][:yaxis][:guide])
    ylabel!(surface_plot, temp)

    # Swap the ticks
    temp = xticks(surface_plot)[1]
    xticks!(surface_plot, yticks(surface_plot)[1])
    yticks!(surface_plot, temp)

    # Transform data appropriately
    xticks!(surface_plot, (xticks(surface_plot)[1][1], reverse(xticks(surface_plot)[1][2])))
    surface_plot[1][1][:z] = Surface(reverse(surface_plot[1][1][:z].surf', dims=2))
end

```

 ![p3_tfc_soln](https://global.discourse-cdn.com/julialang/original/3X/f/9/f9b03f077e7cb255917c483b906f5ca151135ccc.png)

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [December 1, 2023, 7:00am UTC](https://discourse.julialang.org/t/3d-plots-change-axis-intersection-inverse-axis/51109/12 "2023-12-01T07:00:24Z")

</div>

Linking [related thread here](https://discourse.julialang.org/t/how-can-i-move-an-axis-in-a-3d-plot-so-that-it-is-shown-outside-of-the-grid/96365).
