如何删除 Latex 条形图上的多余标签?

如何删除 Latex 条形图上的多余标签?

如何删除X轴上多余的标签:53, 113, 241.

我花了很多时间阅读 pgfplots 和其他方面的手册......

\usepackage{pgfplots}

...

\begin{tikzpicture}    
   \begin{axis}[title = Performance comparison of our approach vs. Synopsys for 100-bit inputs,
      width=320,
      x tick label style={/pgf/number format/1000 sep=},
      symbolic x coords={19, 53, 113, 241},
      legend style={at={(0.5,-0.2)}, anchor=south},
      legend columns=-1,
      ymax=1200,
      ybar,
      ylabel={Frequency, MHz},
      xlabel={Moduli},
      nodes near coords,
      every node near coord/.append style={font=\scriptsize}
   ]    
     \addplot coordinates {(19,1162) (53,840) (113,819) (241, 862)};   
     \addplot coordinates {(19,662) (53,746) (113,892) (241, 869)};
     \addplot coordinates {(19,564) (53,854) (113,634) (241, 789)};

     \legend{Synopsys, group, bits}
   \end{axis} 
\end{tikzpicture}

在此处输入图片描述

答案1

欢迎光临!您似乎正在寻找xtick=data

\documentclass[tikz,border=3mm]{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}

\begin{axis}[title = Performance comparison of our approach vs.\ Synopsys for 100-bit inputs,
    width=320,
    x tick label style={/pgf/number format/1000 sep=},
    symbolic x coords={19, 53, 113, 241},
    xtick=data,
    legend style={at={(0.5,-0.2)}, anchor=south},
    legend columns=-1,
    ymax=1200,
    ybar,
    ylabel={Frequency, MHz},
    xlabel={Moduli},
    nodes near coords,
    every node near coord/.append style={font=\scriptsize}]

\addplot coordinates {(19,1162) (53,840) (113,819) (241, 862)};

\addplot coordinates {(19,662) (53,746) (113,892) (241, 869)};

\addplot coordinates {(19,564) (53,854) (113,634) (241, 789)};

\legend{Synopsys, group, bits}

\end{axis}

\end{tikzpicture}
\end{document}

在此处输入图片描述

\documentclass顺便说一句,如果您向我们提供以 开头和以 结尾\end{document}且可编译的完整的最小工作示例,您通常会更早得到答复。

相关内容