I am using matlab2tikz
to import MATLAB figures into TeX.
However I can't seem to get the x or y minor ticks to show in the document compiled by TeX. The MATLAB figure I have converted to .tikz
have the minor ticks on both axes. The plot in the figure is linear.
In the .tikz
file the xminorticks=true
and yminorticks=true
options are present.
Why won't the minor ticks appear in the compiled document?
EDIT:
Code generated by matlab2tikz
which reproduce the problem for me, all point are spaced evenly:
\begin{tikzpicture}
\begin{axis}[%
view={0}{90},
width=14cm,
height=6cm,
scale only axis,
xmin=1, xmax=10,
xminorticks=true,
ymin=2, ymax=20,
yminorticks=true]
\addplot [
color=blue,
solid,
forget plot
]
coordinates{
(1,2)(2,4)(3,6)(4,8)(5,10)(6,12)(7,14)(8,16)(9,18)(10,20)
};
\end{axis}
\end{tikzpicture}%
Best Answer
You need to tell PGFPlots how many minor ticks you want between each pair of major ticks, by setting
minor tick num=<value>
. You don't need to explicitly turn on the minor ticks withxminorticks=true
, this happens automatically.