I have a question concerning the appearance of the multiplier above axis if scaled ticks = true
is used.
I like to have two curves in one plot. The example shows my problem. I like to have scaled ticks above right axis but it appears above the left axis. Does anybody know how to fix it?
When I created this small example a second question occurs. Try to write
axis y line*=right
instead of axis y line=right
. The label "y pos-right" moves to the left side an top of the "y pos-left". Any explanations for that and how to fix it?
\documentclass[a4paper,10pt]{scrreprt}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
axis y line*=left,
ylabel = y pos-left
]
\addplot[red] coordinates
{(-3,0) (-2,0.1) (-1,-0.6)
(0,1)
(1,-0.6) (2,0.1) (3,0)};
\end{axis}
\begin{axis}[
axis y line=right,
scaled ticks = true,
xlabel = x pos-right,
ylabel = y pos
]
\addplot[blue] coordinates {(-3,-12000) (-2,11000)
(-1,-6000) (0,1000) (1,-100) (2,50) (3,0)};
\end{axis}
\end{tikzpicture}
\end{document}
Thanks in advance
Best Answer
By default, the scale label position is hard-coded to the upper left corner of the plot. If you set the option
ylabel near ticks
, however, this is corrected. It also fixes the incorrect placement of they label
when usingaxis y line*=right
.