I'm using this code
\begin{document}
\def\xmin{5}
\def\xmax{6}
\def\domfactor{4}
\def\xmindom{\xmin/\domfactor}
\def\xmaxdom{\xmin*\domfactor}
{\color{fg}
\begin{tikzpicture}
\begin{axis}[
title={20dB Coupler (5-6$\,\si{GHz}$)},
xlabel={$f$ (GHz)},
ylabel={$S$ ($\si{dB}$)},
axis y line*=left,
xmin=\xmin, xmax=\xmax,
grid=major,
]
\addplot [
red,
] table[x=freq, y=s31] {data/openems_coupler.dat};
\end{axis}
\begin{axis}[
ylabel={Directivity ($\si{dB}$)},
axis y line*=right,
axis x line=none,
xmin=\xmin, xmax=\xmax,
]
\addplot [
orange,
] table[x=freq, y expr={\thisrow{s31}-\thisrow{s41}}] {data/openems_coupler.dat};
\end{axis}
\end{tikzpicture}
}
\end{document}
to create the following plot:
Something bugs me slightly about this, however. I'd like to have the right axis set so that the tick marks appear at the same vertical positions as the left tick marks, which would cause the grid to apply to both sides of the plot. I could, of course, omit the grid, but I like having it there.
Does pgfplots
provide a way to do this, or would I have to attempt it manually (by setting ymin and max and tick set)?
pgfplots
has a way of doing this, so you probably have to calculate/figure out the tick positions manually.ymin
s,ymax
s andytick distance
(s) by hand should do the trick.