I would like to add a second x axis to my single plot. The first x axis goes from 0 to 2, the second one goes from 0 to 0.28. 0.28 on the second axis should be on the same x coordinate as 2 on the first one.
\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage[latin1]{inputenc}
\usepackage{pgfplots}
\usepackage{tikz}
\pgfplotsset{compat=1.16}
\begin{document}
\begin{tikzpicture}[scale=1.3,transform shape]
\begin{axis}[
xlabel={Spulenstrom [A]},
ylabel={Spitze der Volumenverteilung [nm]},
xmin=0,
ymin=0,
scale only axis,
]
\addplot+[black, mark options ={fill = black}, mark=*, error bars/.cd, y dir=both, y explicit,] coordinates {
(0.25, 53.92) +- (21.76, 21.79)
(0.5, 33.9) +- (13.81,13.81)
(0.75, 29.54) +- (11.72, 11.72)
(1, 27.35) +- (12.42, 12.42)
(1.25, 30.38) +- (12.66, 12.66)
(1.5, 24.97) +- (15.08, 15.08)
(1.75, 34.46) +- (16.92, 16.92)
(2, 30.2) +- (13.34, 13.34)
};
\end{axis}
\begin{axis}[
xlabel = {magnetische Flussdichte [T]},
xmin = 0, xmax = 0.28, axis x line*=top, axis y line = none, scale only axis,
]
\end{axis}
\end{tikzpicture}
\end{document}
This is my current code which isn't working. I tried several examples for second y and x axes but all of them assume a second plot.
https://i.stack.imgur.com/riLIB.png This is the picture I currently get with this code