# Log scale with integer numbers on y-axes

I'm writing a report and one of the requirement of my Bode-plots is that they are logarithmic, but I need integer numbers (i.e. 10, 20 and 30) on the y-axes.

I tried using ytick={} but these numbers do not appear in the graph.

Part of my code:

\begin{tikzpicture}
\begin{loglogaxis}[
xlabel=frequentie $f (\hertz)$,
ylabel=weerstand $R (\ohm)$,
grid=both,
minor grid style={gray!25},
major grid style={gray!25},
ytick={10,15,20,25,30}]
\end{loglogaxis}
\end{tikzpicture}


Thanks!

• Welcome to TeX.SX! This should help you out: tex.stackexchange.com/a/139084/21344 Mar 1 '14 at 21:34
• Welcome to the site! Your snippet helps, but it'd be great if you turn it into a complete MWE so that folks don't have to construct anything :) Have you tried yticklabels={10,15,20,25,30}? Mar 1 '14 at 21:35
• Thanks for your quick responses! Oh, I'll mind that next time. I'm quite new to LaTeX and this forum so I still have a lot to learn :) Mar 1 '14 at 23:09

Here is a style example for Bode plots, though you have Ohm as the y-axis unit. In the label computation, \tick already holds the logarithmic value depending on the base we have set. Hence if you simply pretty print with the option fixed you get the desired value. Otherwise using an exponential function you can convert it to the original value.

\documentclass{standalone}
\usepackage{pgfplots,siunitx}
\pgfplotsset{compat=1.9}
\usepgfplotslibrary{units}

\begin{document}

\begin{tikzpicture}
\begin{loglogaxis}[
enlargelimits=false,
grid=both,
ymin=5e-6,ymax=2,
xlabel= Frequency,
ylabel= R,
x unit=\si{\hertz},
y unit=\si{\ohm},
log basis y=10,
log basis x=10,
%dB definition taken as 20 log10(x)
yticklabel={\pgfmathparse{20*(\tick)}\pgfmathprintnumber[fixed]{\pgfmathresult}},
domain=1e-7:1e1,samples=250
]