1

I read this link Label for y-axis on both sides of a pgfplot and I would like to check if it possible to have also xtick and ytick in both sides, i.e. the scale numbers. I am using the same MWE as provided in Label for y-axis on both sides of a pgfplot.

\documentclass{beamer}
\usepackage{pgfplots}

\begin{document}

\pgfplotsset{
ylabel right/.style={
    after end axis/.append code={
        \node [rotate=90, anchor=north] at (rel axis cs:1,0.5) {#1};
    }   
}
}

\begin{tikzpicture}
\begin{axis}[ylabel=Left label, ylabel right=Right label]
\addplot coordinates {(0,1) (1,1)};
\end{axis}
\end{tikzpicture}

\end{document} 
| improve this question | | | | |
1

Like this:

enter image description here

\documentclass{beamer}
\usepackage{pgfplots}
\pgfplotsset{compat=1.14}

\begin{document}
    \begin{tikzpicture}
\begin{axis}[
    ylabel=Left label 
            ]
\addplot coordinates {(0,1) (1,1)};
\end{axis}
\begin{axis}[
ylabel=Right label,
y label style={at={(1.12,0.5)},anchor=north},
yticklabel pos=right
            ]
\end{axis}
    \end{tikzpicture}
\end{document}
| improve this answer | | | | |
  • Perfect, congrats! – unmark1 Sep 29 '16 at 19:09
  • What's \pgfplotsset{compat=1.14} for? – Jason Gross Feb 28 '18 at 3:36
  • @JasonGross, defined with which version of pgfplotsd was drawn. today is recent 1.15. – Zarko Feb 28 '18 at 7:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.