pgf/tikz:字符串符号作为输入坐标
题
我是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}
当我尝试使用该命令时,我遇到了问题(特别是“绘图坐标/数学解析器”),但是随后我更新了Package PGFPLOTS,并且都可以使用。
不隶属于 StackOverflow