我想知道如何禁用 ybar 标签中的科学计数法。这是 tex 代码:
\begin{axis}
[width=6cm, height=6cm,
yticklabel style={/pgf/number format/fixed},
ybar=5pt,
ylabel=Cost,
x=2cm,
ymin=0,
xtick=data,
nodes near coords,
every node near coord/.append style={ anchor=mid west, rotate=90},
symbolic x coords={A,B,C,D,E},
axis lines*=left,
]
\addplot coordinates { (A,12398) (B,31814) (C,30833) (D,72290) (E,9078)}; %Greedy
\end{axis}
\end{tikzpicture}
\end{figure}
答案1
您可以使用scaled y ticks=false
:
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture}
\begin{axis}
[width=6cm, height=6cm,
ybar=5pt,
ylabel=Cost,
x=2cm,
ymin=0,
xtick=data,
nodes near coords,
every node near coord/.append style={ anchor=mid west, rotate=90},
symbolic x coords={A,B,C,D,E},
axis lines*=left,
scaled y ticks=false,
]
\addplot coordinates { (A,12398) (B,31814) (C,30833) (D,72290) (E,9078)}; %Greedy
\end{axis}
\end{tikzpicture}
\end{document}