pgf-tikz / pgfplots

pgfplots - A TeX package to draw normal and/or logarithmic plots directly in TeX in two and three dimensions with a user-friendly interface and pgfplotstable - a TeX package to round and format numerical tables. Examples in manuals and/or on web site.

Home Page:http://pgfplots.sourceforge.net/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The Y label on the right axis

K-Arakawa opened this issue · comments

I'd like to draw a graph with a right Y axis.

% Intended LaTeX compiler: lualatex
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\usepackage[utf8]{inputenc}
\usepackage{fontspec} % This line only for XeLaTeX and LuaLaTeX
\usepackage{pgfplots}
\pagestyle{empty}

\begin{document}

\begin{tikzpicture}

  \begin{axis}[
    separate axis lines,
    axis y line=right,
    log basis x={10},
    tick align=outside,
    xlabel={X AXIS LABEL},
    xmin=8.91250938133746e-06, xmax=0.000112201845430196,
    xmode=log,
    xtick pos=left,
    xtick={1e-05,2e-05,3e-05,5e-05,0.0001},
    xticklabels={
      \(\displaystyle 10^{-5}\),
      \(\displaystyle 2\times 10^{-5}\),
      ,
      \(\displaystyle 5\times 10^{-5}\),
      \(\displaystyle 10^{-4}\)
    },
    ylabel=Y AXIS LABEL,
    ymin=0.398683259, ymax=0.482096281,
    ytick pos=right,
    yticklabel style={anchor=west}
    ]
    \addplot [semithick, mark=*, mark size=3, mark options={solid}]
    table {%
      1e-05 0.43360166
      2e-05 0.40644302
      3e-05 0.40247476
      5e-05 0.44427334
      0.0001 0.47830478
    };
  \end{axis}

\end{tikzpicture}

\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:

Everything is OK on this step. Next I'd like to remove the arrow tip of the Y axis. So I replace axis y line=right, with axis y line*=right,, but this time the label of the Y axis moves to the left side. Can I keep the label position?

Add \pgfplotsset{compat=1.3} or a higher value to the preamble and it works as expected.

It works fine. Thanx a lot.