如何增加 tikzpicture 中条之间的空间?

如何增加 tikzpicture 中条之间的空间?

我怎样才能增加条形之间的垂直空间,以便标签不会像下面这样混合在一起?

这是我的 MWE:

\documentclass[conference]{IEEEtran}
\usepackage{cite}
\usepackage{pgfplots}

\begin{document}
%Here goes the title
\title{Generate IEEE styled Bibliography for All Types of  Items}
\maketitle

%Main body starts
% \input{sections/1_introduction}

\begin{figure}[!htbp]
    \centering
    {
        %\resizebox{0.65\columnwidth}{!}
        {%
        \begin{tikzpicture}
        \begin{axis}[
        %width  = 0.85*\textwidth,
        height = 5cm,
        major x tick style = transparent,
        ybar=10*\pgflinewidth,
        bar width=14pt,
        ymajorgrids = true,
        ylabel = {Percentage},
        symbolic x coords={a,b,c,d},
        xticklabel style={align=center,text width=20mm},
        xticklabels={{augue ante mollis nunc, vitae eleifend nulla},Lorem ipsum dolor sit amet, consectetur adipiscing elit,Ut velit lorem, gravida nec lacinia a, finibus et risus.},
        xtick = data,
        scaled y ticks = false,
        enlarge x limits=0.25,
        ymin=0,
        % ymax=100,
        legend cell align=left,
        legend style={
        at={(1,1.05)},
        anchor=south east,
        column sep=1ex
        }
        ]
        \addplot[style={fill=black!50,mark=none}]
        coordinates {(a,88.9) (b,80) (c,92.5)};

        \end{axis}
        \end{tikzpicture}
        }
    }
    \caption{Exam results.}
    \label{fig:exam_results}
\end{figure}

\bibliographystyle{IEEEtran}
\bibliography{main}

\end{document}

答案1

用于x=2cm指定x unit vectoraxis cs在此处输入图片描述

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.17}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
  x=2cm,
  %width  = 0.85*\textwidth,
  height = 5cm,
  major x tick style = transparent,
  ybar=10*\pgflinewidth,
  bar width=14pt,
  ymajorgrids = true,
  ylabel = {Percentage},
  symbolic x coords={a,b,c,d},
  xticklabel style={align=center,text width=20mm},
  xticklabels={{augue ante mollis nunc, vitae eleifend nulla},Lorem ipsum dolor sit amet, consectetur adipiscing elit,Ut velit lorem, gravida nec lacinia a, finibus et risus.},
  xtick = data,
  scaled y ticks = false,
  enlarge x limits=0.25,
  ymin=0,
  % ymax=100,
  legend cell align=left,
  legend style={
  at={(1,1.05)},
  anchor=south east,
  column sep=1ex
  }
  ]
  \addplot[style={fill=black!50,mark=none}]
  coordinates {(a,88.9) (b,80) (c,92.5)};

\end{axis}
\end{tikzpicture}
\end{document}

相关内容