我正在制作水平条形图,但 x 轴和每个条形中的数字是指数的,我想要一个“正常”数字。我该怎么做?
\begin{figure}[h]
\centering
\begin{tikzpicture}
\begin{axis}[
xbar,
width=12cm, height=6cm, enlarge y limits=0.2,
xlabel={total de edifícios certificados},
xticklabel style={/pgf/number format/fixed},
symbolic y coords={HQE, BREEAM, LEED, DGNB, Green Star, Living Building},
ytick=data,
nodes near coords, nodes near coords align={horizontal},
]
\addplot coordinates {(266000,HQE) (250000,BREEAM)(51700,LEED)(834,DGNB)(256,Green Star)(192,Living Building)};
\end{axis}
\end{tikzpicture}
答案1
用于scaled x ticks=false
删除 x 轴上的缩放。如果您还想消除条形标签上的缩放,您可以使用every node near coord/.style={/pgf/number format/fixed}
:
笔记:
- 我还添加了
xmax=310000
框内的数字。
代码:
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xbar,
width=12cm, height=6cm, enlarge y limits=0.2,
xlabel={total de edifícios certificados},
xticklabel style={/pgf/number format/fixed},
symbolic y coords={HQE, BREEAM, LEED, DGNB, Green Star, Living Building},
ytick=data,
nodes near coords, nodes near coords align={horizontal},
scaled x ticks=false,
every node near coord/.style={/pgf/number format/fixed},
xmax=310000,
]
\addplot coordinates {(266000,HQE) (250000,BREEAM)(51700,LEED)(834,DGNB)(256,Green Star)(192,Living Building)};
\end{axis}
\end{tikzpicture}
\end{document}