String pgf/tikz:字符串符号作为输入坐标

String pgf/tikz:字符串符号作为输入坐标,string,axis,plot,tikz,pgf,String,Axis,Plot,Tikz,Pgf,我是pgf新手,所以我尝试了pgfplot手册中的一些示例。其中一个例子与我当前的任务特别相关,但是,唉,它无法编译 代码如下: \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+[s

我是pgf新手,所以我尝试了pgfplot手册中的一些示例。其中一个例子与我当前的任务特别相关,但是,唉,它无法编译

代码如下:

\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}
编译器退出,出现以下错误:

! Package PGF Math Error: Could not parse input 'a' as a floating point number,
 sorry. The unreadable part was near 'a'..
我不知道如何纠正这种行为。其他仅包含数值数据的图(平滑、散点、条形图)编译良好

谁能给我一个提示吗

干杯


K.

您需要在序言中包含以下内容:

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

当我尝试使用该命令(特别是“绘图坐标/数学解析器”)时,我遇到了问题,但随后我更新了程序包pgfplots,并且所有程序都正常工作。

您确定您已经获得了最新版本的
tikz
pgfplots
?因为你的代码示例对我来说很好。并因提供了一个很好的最低限度的工作示例而受到赞誉。