pgfplots 的 ybar 没有科学依据

pgfplots 的 ybar 没有科学依据

我想知道如何禁用 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}

在此处输入图片描述

相关内容