2

I am trying to draw Minkowski diagrams using tikz and got as far as below.

How do I align the origins of the two coordinate systems, i.e. how do I move up the B-system? I tried various things with the anchor option, which moved the system around, but I couldn't get it to where it is supposed to be.

\documentclass[a4paper]{article}

\usepackage{tikz,pgfplots,siunitx}

\begin{document} \begin{tikzpicture}

\begin{axis}[
   black,
   anchor=south west,
   axis lines=center,
   xmin=0, xmax=14.9,
   ymin=-2.5,ymax=12.5,
   xtick distance=1,  %xticklabel={\empty},
   ytick distance=1,  %yticklabel={\empty},
   grid,
   x={1cm}, y={1cm},
   xlabel={$t_\mathrm{A}$ in \SI{e-8}{\second}}, ylabel={$x_\mathrm{A}$ in \SI{e-8}{\meter}},
   thick, every tick/.style={thick}
   ] 


  \end{axis}

\begin{axis}[
   black,
   anchor=south west,
   axis lines=center,
   xmin=0,xmax=11.2,
   ymin=0,ymax=9.9,
   xtick distance=1, % xticklabel={\empty},
   ytick distance=1, % yticklabel={\empty},
   x={(1.25cm,0.75cm)}, y={(0.75cm,1.25cm)},
   xlabel={$t_\mathrm{B}$ in \SI{e-8}{\second}}, ylabel={$x_\mathrm{B}$ in \SI{e-8}{\meter}},
    xlabel style={right},
   thick, every tick/.style={thick},
   ]

\end{axis}

\end{tikzpicture}

\end{document}

user1583209
  • 785
  • 4
  • 12

1 Answers1

1

The anchors of an axis are described in the pgfplots manual section 4.19 Alignment options, (page 374-75, in the manual for version 1.18.1).

For your case, add anchor=origin to both environments, which will place their origins at the same coordinate (or the coordinate specified by at={(<coordinate>)}).

Torbjørn T.
  • 206,688