Following my previous question, I found that the minor grid is removed between 0 and 0.5.
So, I tried to add grid = minor inside extra tick style
\documentclass[border=5pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xtick={0.5,1,...,4.5},
xmin=0,xmax=5,
minor x tick num = {1},
minor x tick style = {line width = 2pt},
major x tick style = {line width = 2pt},
xmajorgrids, xminorgrids,
major x grid style = {dashed,red},
minor x grid style = {dotted,black},
extra x ticks={0,5},
extra tick style={
grid=minor,
},]
\addplot[mark=none,blue] {x^2};
\end{axis}
\end{tikzpicture}
\end{document}
but it results in this
What I need is to
- remove the major ticks at
0and5and - place minor ticks at
0.25
Digressive Question
Why is there a minor tick placed at 4.75 and not at 0.25?


tick style={draw=none}toextra tick style. And I think for the digressive question the answer is: I think the minor tick shouldn't be drawn for 4.75 neither, so this can be considered being a bug ... – Stefan Pinnow Apr 11 '17 at 17:490.25? – Diaa Apr 11 '17 at 17:52