0

I'm trying to plot a single axis with symbolic values on ticks:

\begin{tikzpicture}
    \begin{axis}[
        xlabel={$x$},
        axis x line=center,
        axis y line=none,
        symbolic x coords={0,$x_1$, $x_2$, $x_3$, $x_4$},
        xmin={[normalized]0},
        xmax={[normalized]5},
        xtickmax={[normalized]4},
        xtick distance=1]
    \end{axis}
\end{tikzpicture}

Where was I wrong? On the axis there is only x1

Thank you so much in advance.

2

You have to set ymin and ymax to avoid the empty range issue and the usage of the default range 0-1 for both the x- and the y-axis.

Example:

\documentclass[margin=5pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.15}
\begin{document}
\begin{tikzpicture}
    \begin{axis}[
        xlabel={$x$},
        axis x line=center,
        axis y line=none,
        symbolic x coords={0,$x_1$, $x_2$, $x_3$, $x_4$},
        xmin={[normalized]0},
        xmax={[normalized]5},
        xtickmax={[normalized]4},
        xtick distance=1,
        ymin=0,ymax=0% <- added
        ]
    \end{axis}
\end{tikzpicture}
\end{document}

Result:

enter image description here

  • Thank you very very much @esdd! Your patience is infinity! – Gennaro Arguzzi Nov 6 '17 at 9:53

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.