我希望有人能帮助我。我正在尝试在论文中插入一些条形图,我花了很长时间寻找解决方案。我发现另一个问题,其中的答案是以下代码:
\documentclass[tikz]{standalone}
\usepackage{pgfplots}
\begin{document}
\pgfplotstableread[row sep=\\,col sep=&]{
interval & carT & carD & carR \\
0--2 & 1.2 & 0.1 & 0.2 \\
2--5 & 12.8 & 3.8 & 4.9 \\
5--10 & 15.5 & 10.4 & 13.4 \\
10--20 & 14.0 & 17.3 & 22.2 \\
20--50 & 7.9 & 21.1 & 27.0 \\
50+ & 3.0 & 22.3 & 28.6 \\
}\mydata
\begin{tikzpicture}
\begin{axis}[
ybar,
bar width=.5cm,
width=\textwidth,
height=.5\textwidth,
legend style={at={(0.5,1)},
anchor=north,legend columns=-1},
symbolic x coords={0--2,2--5,5--10,10--20,20--50,50+},
xtick=data,
nodes near coords,
nodes near coords align={vertical},
ymin=0,ymax=35,
ylabel={\%},
]
\addplot table[x=interval,y=carT]{\mydata};
\addplot table[x=interval,y=carD]{\mydata};
\addplot table[x=interval,y=carR]{\mydata};
\legend{Trips, Distance, Energy}
\end{axis}
\end{tikzpicture}
\end{document}
我只是复制了这段代码,没有做其他任何事情。pdf 无法编译,显示的错误如下:
Undefined control sequence. ...; color(2cm)=(orange); color(3cm)=(red)}
Package pgfkeys Error: I do not know the key '/pgf/fpu', to which you passed 'true', and I am going to ignore it. Perhaps you misspelled it. ...; color(2cm)=(orange); color(3cm)=(red)}
Undefined control sequence. ...; color(2cm)=(orange); color(3cm)=(red)}
Missing \begin{document}. ...; color(2cm)=(orange); color(3cm)=(red)}
Undefined control sequence. ...; color(2cm)=(orange); color(3cm)=(red)}
Undefined control sequence. ...; color(2cm)=(orange); color(3cm)=(red)}
Package PGF Math Error: Sorry, an internal routine of the floating point unit near '28.45274'.. ...; color(2cm)=(orange); color(3cm)=(red)}
Package pgfplots Error: Colormaps must have increasing positions. The providesign increasing positions. ...; color(2cm)=(orange); color(3cm)=(red)}
Undefined control sequence. ...; color(2cm)=(orange); color(3cm)=(red)}
Undefined control sequence. ...; color(2cm)=(orange); color(3cm)=(red)}
Package PGF Math Error: Sorry, an internal routine of the floating point unitnear '56.9055'.. ...; color(2cm)=(orange); color(3cm)=(red)}
Package pgfplots Error: Colormaps must have increasing positions. The providesign increasing positions. ...; color(2cm)=(orange); color(3cm)=(red)}
Undefined control sequence. ...; color(2cm)=(orange); color(3cm)=(red)}
Undefined control sequence. ...; color(2cm)=(orange); color(3cm)=(red)}
Package PGF Math Error: Sorry, an internal routine of the floating point unitnear '56.9055'.. ...; color(2cm)=(orange); color(3cm)=(red)}
Missing number, treated as zero. ...; color(2cm)=(orange); color(3cm)=(red)}
Missing number, treated as zero. ...; color(2cm)=(orange); color(3cm)=(red)}
Illegal unit of measure (pt inserted). ...; color(2cm)=(orange); color(3cm)=(red)}
Undefined control sequence. ...; color(2cm)=(orange); color(3cm)=(red)}
Undefined control sequence. ...; color(2cm)=(orange); color(3cm)=(red)}
Package PGF Math Error: Sorry, an internal routine of the floating point unit near '85.35826'.. ...; color(2cm)=(orange); color(3cm)=(red)}
Package pgfplots Error: Colormaps must have increasing positions. The providen increasing positions. ...; color(2cm)=(orange); color(3cm)=(red)}
Undefined control sequence. ...; color(2cm)=(orange); color(3cm)=(red)}
Undefined control sequence. ...; color(2cm)=(orange); color(3cm)=(red)}
Package PGF Math Error: Sorry, an internal routine of the floating point unit near '85.35826'.. ...; color(2cm)=(orange); color(3cm)=(red)}
Missing number, treated as zero. ...; color(2cm)=(orange); color(3cm)=(red)}
Missing number, treated as zero. ...; color(2cm)=(orange); color(3cm)=(red)}
Illegal unit of measure (pt inserted). ...; color(2cm)=(orange); color(3cm)=(red)}
Undefined control sequence. ...; color(2cm)=(orange); color(3cm)=(red)}
Undefined control sequence. ...; color(2cm)=(orange); color(3cm)=(red)}
Undefined control sequence. ...; color(2cm)=(orange); color(3cm)=(red)}
Undefined control sequence. ...; color(2cm)=(orange); color(3cm)=(red)}
Package PGF Math Error: Sorry, an internal routine of the floating point unit.. ...; color(2cm)=(orange); color(3cm)=(red)}
Missing number, treated as zero. ...; color(2cm)=(orange); color(3cm)=(red)}
Illegal unit of measure (pt inserted). ...; color(2cm)=(orange); color(3cm)=(red)}
Undefined control sequence. ...; color(2cm)=(orange); color(3cm)=(red)}
Package PGF Math Error: Sorry, an internal routine of the floating point unit '0.0'.. ...; color(2cm)=(orange); color(3cm)=(red)}
Missing number, treated as zero. ...; color(2cm)=(orange); color(3cm)=(red)}
Illegal unit of measure (pt inserted). ...; color(2cm)=(orange); color(3cm)=(red)}
Undefined control sequence. ...edcolormap}{color=(black) color=(black)}
Package pgfkeys Error: I do not know the key '/pgf/fpu', to which you passed 'true', and I am going to ignore it. Perhaps you misspelled it. ...edcolormap}{color=(black) color=(black)}
Package PGF Math Error: Unknown operator `Y' or `Y0' (in '0Y0.0e0]'). ...edcolormap}{color=(black) color=(black)}
Undefined control sequence. ...edcolormap}{color=(black) color=(black)}
Missing \begin{document}. ...edcolormap}{color=(black) color=(black)}
Package PGF Math Error: Unknown operator `Y' or `Y2' (in '1Y2.845274e1]'). ...edcolormap}{color=(black) color=(black)}
Undefined control sequence. ...edcolormap}{color=(black) color=(black)}
Undefined control sequence. ...edcolormap}{color=(black) color=(black)}
Package PGF Math Error: Sorry, an internal routine of the floating point unit0'.. ...edcolormap}{color=(black) color=(black)}
Package pgfplots Error: Colormaps must have increasing positions. The providePlease assign increasing positions. ...edcolormap}{color=(black) color=(black)}
Undefined control sequence. ...edcolormap}{color=(black) color=(black)}
Undefined control sequence. ...edcolormap}{color=(black) color=(black)}
Undefined control sequence. ...edcolormap}{color=(black) color=(black)}
Undefined control sequence. ...edcolormap}{color=(black) color=(black)}
Package PGF Math Error: Sorry, an internal routine of the floating point unit0'.. ...edcolormap}{color=(black) color=(black)}
Missing number, treated as zero. ...edcolormap}{color=(black) color=(black)}
Illegal unit of measure (pt inserted). ...edcolormap}{color=(black) color=(black)}
Undefined control sequence. ...edcolormap}{color=(black) color=(black)}
Package PGF Math Error: Sorry, an internal routine of the floating point unit '0.0'.. ...edcolormap}{color=(black) color=(black)}
Missing number, treated as zero. ...edcolormap}{color=(black) color=(black)}
Illegal unit of measure (pt inserted). ...edcolormap}{color=(black) color=(black)}
Undefined control sequence. }
Package pgfkeys Error: I do not know the key '/pgf/fpu', to which you passed 'true', and I am going to ignore it. Perhaps you misspelled it. }
Package PGF Math Error: Unknown operator `Y' or `Y0' (in '0Y0.0e0]'). }
Undefined control sequence. }
Missing \begin{document}. }
Package PGF Math Error: Unknown operator `Y' or `Y2' (in '1Y2.845274e1]'). }
Undefined control sequence. }
Undefined control sequence. }
Package PGF Math Error: Sorry, an internal routine of the floating point unit0'.. }
Package pgfplots Error: Colormaps must have increasing positions. The provide (color no 1) . Please assign increasing positions. }
Undefined control sequence. }
Undefined control sequence. }
Undefined control sequence. }
Package PGF Math Error: Sorry, an internal routine of the floating point unit0'.. }
Package pgfplots Error: Colormaps must have increasing positions. The provide. Please assign increasing positions. }
Undefined control sequence. }
Undefined control sequence. }
Package PGF Math Error: Sorry, an internal routine of the floating point unit0'.. }
Missing number, treated as zero. }
Missing number, treated as zero. }
Illegal unit of measure (pt inserted). }
Undefined control sequence. }
Undefined control sequence. }
Undefined control sequence. }
Package PGF Math Error: Sorry, an internal routine of the floating point unit.. }
Package pgfplots Error: Colormaps must have increasing positions. The provide . Please assign increasing positions. }
Undefined control sequence. }
Undefined control sequence. }
Package PGF Math Error: Sorry, an internal routine of the floating point unit.. }
Missing number, treated as zero. }
Missing number, treated as zero. }
Illegal unit of measure (pt inserted). }
Undefined control sequence. }
Undefined control sequence. }
Undefined control sequence. }
Package PGF Math Error: Sorry, an internal routine of the floating point unit.. }
Package pgfplots Error: Colormaps must have increasing positions. The provide. Please assign increasing positions. }
Undefined control sequence. }
Undefined control sequence. }
Package PGF Math Error: Sorry, an internal routine of the floating point unit.. }
Missing number, treated as zero. }
Missing number, treated as zero. }
Illegal unit of measure (pt inserted). }
Undefined control sequence. }
Undefined control sequence. }
Undefined control sequence. }
Package PGF Math Error: Sorry, an internal routine of the floating point unit.. }
Package pgfplots Error: Colormaps must have increasing positions. The provide . Please assign increasing positions. }
Undefined control sequence. }
Undefined control sequence. }
Package PGF Math Error: Sorry, an internal routine of the floating point unit.. }
Missing number, treated as zero. }
Missing number, treated as zero. }
Illegal unit of measure (pt inserted). }
Undefined control sequence. }
Undefined control sequence. }
Undefined control sequence. }
Package PGF Math Error: Sorry, an internal routine of the floating point unit.. }
Package pgfplots Error: Colormaps must have increasing positions. The provide . Please assign increasing positions. }
Undefined control sequence. }
Undefined control sequence. }
Package PGF Math Error: Sorry, an internal routine of the floating point unit.. }
Missing number, treated as zero. }
Missing number, treated as zero. }
Illegal unit of measure (pt inserted). }
Undefined control sequence. }
Undefined control sequence. }
Undefined control sequence. }
Package PGF Math Error: Sorry, an internal routine of the floating point unit.. }
Package pgfplots Error: Colormaps must have increasing positions. The provide. Please assign increasing positions. }
Undefined control sequence. }
Undefined control sequence. }
Package PGF Math Error: Sorry, an internal routine of the floating point unit.. }
Missing number, treated as zero. }
Missing number, treated as zero. }
Illegal unit of measure (pt inserted). }
Undefined control sequence. }
Undefined control sequence. }
Undefined control sequence. }
Package PGF Math Error: Sorry, an internal routine of the floating point unit.. }
Package pgfplots Error: Colormaps must have increasing positions. The provide. Please assign increasing positions. }
Undefined control sequence. }
Undefined control sequence. }
Package PGF Math Error: Sorry, an internal routine of the floating point unit.. }
Missing number, treated as zero. }
Missing number, treated as zero. }
Illegal unit of measure (pt inserted). }
Undefined control sequence. }
Undefined control sequence. }
Undefined control sequence. }
Package PGF Math Error: Sorry, an internal routine of the floating point unit.. }
Package pgfplots Error: Colormaps must have increasing positions. The provide . Please assign increasing positions. }
Undefined control sequence. }
Undefined control sequence. }
Package PGF Math Error: Sorry, an internal routine of the floating point unit.. }
Missing number, treated as zero. }
Missing number, treated as zero. }
Illegal unit of measure (pt inserted). }
Undefined control sequence. }
Undefined control sequence. }
Overfull \hbox (63.89009pt too wide) in paragraph
Overfull \hbox (98.61243pt too wide) in paragraph
我对此一无所知(我使用 Texstudio),也不知道该怎么做。如果已经存在解决此问题的方法,请分享链接。如果我的英语不够清楚,我很抱歉。非常感谢任何愿意帮助我的人。