I want to make a 2nd y-axis in my plot but without data. So that at the left y-axis is the wavenumber and on the right the wavelength in my special case. I've already managed to get the 2nd axis but now this should also show the correct values: wavelength=1/wavenumber. How can I achieve this?
\documentclass[10pt, a4paper, twoside,ngerman]{scrreprt}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots}
\begin{document}
\begin{figure}[h]
\begin{tikzpicture}
\pgfplotstableread{1.txt} \datA
\begin{axis}[
axis y line*=left,
ylabel near ticks,
xlabel near ticks,
xlabel=Temperatur in K,
ylabel=Wellenzahl in cm-1,
every x tick scale label/.style={at={(xticklabel cs:1)},anchor=south west},
every axis plot/.append style={mark=none} ,
legend pos=north west,
legend style={draw=none, fill=none},
title style={yshift=0.75cm},
title=(a),
]
\addplot table [x index = 0, y index = 1] from \datA ;
\end{axis}
\begin{axis}[
axis y line*=right,
axis x line=none,
ylabel near ticks,
xlabel near ticks,
y dir=reverse,
ylabel=Wellenlänge in nm,
every x tick scale label/.style={tick style={draw=none}},
every axis plot/.append style={mark=none}
]
\end{axis}
\end{tikzpicture}
\end{figure}
\end{document}
1.txt:
1 3000
2 3001
3 3002
4 3003
5 3004

yticklabel={\pgfmathprintnumber[sci,precision=6]{\tick}}, y coord trafo/.code=\pgfmathparse{3000/#1}, y coord inv trafo/.code=\pgfmathparse{#1/3000},. And usefilecontentsto make life simpler for others, i.e. add\begin{filecontents}{1.txt} 1 3000 2 3001 3 3002 4 3003 5 3004 \end{filecontents}to the preamble of your document.