开发者

pgf/tikz: String Symbols as Input Coordinates

I'm new to pgf so i was trying out some examples from the pgfplot manual. One e开发者_开发知识库xample is especially relevant for my current task but, alas, it would not compile.

Here is the code:

\documentclass[11pt]{article}
\usepackage{tikz}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture} 
    \begin{axis}[symbolic x coords={a,b,c,d,e,f,g,h,i}] 
        \addplot+[smooth] coordinates { 
            (a,42) 
            (b,50) 
            (c,80) 
            (f,60) 
            (g,62) 
            (i,90)}; 
    \end{axis} 
\end{tikzpicture} 
\end{document}

the compiler quits with the following error:

! Package PGF Math Error: Could not parse input 'a' as a floating point number,
 sorry. The unreadable part was near 'a'..

I have no clue how to correct this behavior. Other plots (smooth, scatter, bar), which contain only numerical data compile fine.

Could anybody give me a hint?

Cheers

K.


You need to include this in the preamble:

\pgfplotsset{xticklabel={\tick},scaled x ticks=false}
\pgfplotsset{plot coordinates/math parser=false}

I had problems with this command when I tried to use it (specifically the "plot coordinates/math parser"), but then I updated the package pgfplots and it all worked.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜