1

I am trying to make the tick labels of extra ticks of a loglog axis (ie in the MWE, extra x ticks={.5}),consistent with the "log ticks with fixed point", the general format of the label ticks in the example. I have not found a solution.

\documentclass[paper=a4, border=1cm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.8}

\begin{document}
\begin{tikzpicture}
\begin{loglogaxis}[
grid=both,
width=\textwidth, height=\textwidth,
log ticks with fixed point,
xmin=.005,
xmax =1,
ymin=100,
ymax =200,
extra x ticks={.5}, % how to convert to fixed point tick label ?
ytick={100, 110, 120, 130, 140 , 150, 160, 170, 180 ,190, 200},
legend style={at={(.995,.94)},anchor=east},
]
\addplot [green, ] coordinates {
(.47,50)
(.048, 500)
};
\addplot [blue, ] coordinates {
(.11, 23)
(.0053, 500)
};
\end{loglogaxis}
\end{tikzpicture}
\end{document}
3

The key is that the default style of the extra ticks is set to log identify minor tick positions=true, which sets the formatting no matter how you set /pgf/number format (which I assume you tried). This option is described on page 268 of the 1.11 manual (is there a reason to use compat=1.8?). Anyway, the fix is to set log identify minor tick positions=false in the extra x tick style:

\documentclass[border=1cm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.8}

\begin{document}
\begin{tikzpicture}
\begin{loglogaxis}[
grid=both,
width=\textwidth, height=\textwidth,
log ticks with fixed point,
xmin=.005,
xmax =1,
ymin=100,
ymax =200,
extra x ticks={.5}, % how to convert to fixed point tick label ?
extra x tick style={log identify minor tick positions=false},
ytick={100, 110, 120, 130, 140 , 150, 160, 170, 180 ,190, 200},
legend style={at={(.995,.94)},anchor=east},
]
\addplot [green, ] coordinates {
(.47,50)
(.048, 500)
};
\addplot [blue, ] coordinates {
(.11, 23)
(.0053, 500)
};
\end{loglogaxis}
\end{tikzpicture}
\end{document}

enter image description here

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.