1
  • This question is about a 3D coordinate system in pgfplots.
  • Problem 1: I want to have the xlabel on the "other side" (tried x dir = reverse, already).
  • Problem 2: This is less important (nice to have). I want to have the perspective as in my hand drawing (a perfect cross: y and z, and the 3rd dimension, depth, is indicated by a 45 degree line: x), see "Remark" in the hand drawing. Additional Remark: In the hand drawing I use different labels (this is a typical automotive coordinate system). But I can fake that by just naming the xlabel "y" and so on.

\documentclass{standalone} 
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}

\begin{document}

\begin{tikzpicture} \begin{axis}[ width = 80mm, height = 80mm, axis lines = center, no marks, axis line style = {latex-latex, ultra thick}, % unit vector ratio = 1 1 1, ticks = none, xmin = -1, xmax = 1, ymin = -1, ymax = 1,
zmin = -1, zmax = 1,
xlabel = $x$, ylabel = $y$, zlabel = $z$, ] % No plot \end{axis} \end{tikzpicture}

\end{document}

enter image description here

enter image description here

Related

1 Answers1

1

For you first request you can use x dir=reverse swap the position of xmin and xmax. However, this does not move the xlabel. Here you can use

every axis x label/.style={at=(ticklabel cs:-0.07)}

The ticklabel cs: starts at 0 at one end of the axis and ends at 1 at the other, so 0.07 puts the label just beyond the "beginning" of the axis. Putting this together, and adding a plot that shows the positive first quadrant for x and y, and using the same idea to adjust the ylabel, we get

Sample output

\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}

\begin{document}

\begin{tikzpicture} \begin{axis}[ width = 80mm, height = 80mm, axis lines = center, no marks, axis line style = {latex-latex, ultra thick}, % unit vector ratio = 1 1 1, ticks = none, xmin = -1, xmax = 1, ymin = -1, ymax = 1, zmin = -1, zmax = 1, x dir=reverse, every axis x label/.style={at={(xticklabel cs:-0.07)}}, every axis y label/.style={at={(yticklabel cs:1.07)}}, xlabel = $x$, ylabel = $y$, zlabel = $z$, ] \addplot3 [surf, z buffer=sort, samples=15, variable=\u, variable y=\v, domain=0:1, y domain=0:1, opacity=0.5] ({u},{v},0); \end{axis} \end{tikzpicture}

\end{document}

Unfortuantely pgfplots does not support perspective drawing.

Andrew Swann
  • 95,762
  • Thanks a lot. Do you know which setting for the x label position is used by default? – Dr. Manuel Kuehner Nov 08 '22 at 15:03
  • And thanks for showing me that there is no built-in, automatic, way to change the label's position as a result of the reverse option etc. I was assuming that I miss a magic option. – Dr. Manuel Kuehner Nov 08 '22 at 15:53
  • 1
    Happy to hear this was useful. You can get the default/current value by writing every axis x label/.show code which for me gives near ticklabel align=inside,at={(ticklabel* cs:1)}, anchor=near ticklabel opposite} – Andrew Swann Nov 09 '22 at 17:14