Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

The following code is used to produce the plot below.

\pgfplotsset{
    axis equal image,
    xtick={1,2,3,4},
    ytick={1},
    minor y tick num={1},
    minor x tick num={1},
    xmin=-0.3, 
    xmax=4.2, 
    ymin=-0.3, 
    ymax=2.2,
    axis x line=middle,
    axis y line=middle,
    axis equal image,
    xlabel=$t$,
    every axis plot/.append style={line width=1pt}
}   

(...)     

\begin{tikzpicture}
    \begin{axis} [ylabel=$s_6(t)$]
    \end{axis}
\end{tikzpicture}    

enter image description here

Now I wonder why there is no 0.5 tick, neither at the X, nor the Y axis. I know that I can manually add them, but then there will be captions as well (which I don't like). Can anyone help me out to explain what wrong assumptions I made or which pitfall I ran into?

share|improve this question
5  
Instead of providing the complete tick list explicitly, you can also use xtick={0,...,4}, which will fill in the numbers using a step of 1. If you want a different step size, you can specify the first two numbers in the series, e.g. xtick={0,5,...,50} would give you the numbers 0, 5, 10, 15 etc. –  Jake Aug 20 '12 at 7:03
    
@Jake, thank you for the hint -- indeed this makes the code more pretty. –  wal-o-mat Aug 20 '12 at 9:11

1 Answer 1

up vote 8 down vote accepted

Add zero to your tick list such that minor ticks can be added between two tick points.

\documentclass{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
    \begin{axis}[
    axis equal image,
    xtick={0,1,2,3,4},
    ytick={0,1},
    minor y tick num={1},
    minor x tick num={1},
    xmin=-0.3, 
    xmax=4.2, 
    ymin=-0.3, 
    ymax=2.2,
    axis x line=middle,
    axis y line=middle,
    xlabel=$t$,
 ylabel=$s_6(t)$]
    \end{axis}
\end{tikzpicture}
\end{document}

enter image description here

share|improve this answer
    
Thank you! This (a) works and (b) makes sense for me. –  wal-o-mat Aug 20 '12 at 10:44
    
@wal-o-mat My pleasure. –  percusse Aug 20 '12 at 20:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.