아래 MWE에서:
\documentclass{report}
\usepackage[left=2.5cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage[T1]{fontenc}
\usepackage{tikz,pgf}
\usepackage{pgfplots}
\usepackage{slashbox}
\usepackage{bchart}
\usetikzlibrary{calc,trees,positioning,arrows,chains,shapes.geometric,%
decorations.pathreplacing,decorations.pathmorphing,shapes,%
matrix,shapes.symbols,automata}
\begin{document}
\begin{figure}[H]
\centering
\begin{tikzpicture}
\begin{axis}[
ybar,
ylabel={Time Elapsed (in hours)},
xlabel={Methods},
legend style={at={(0.5,-0.15)},
anchor=north,legend columns=-1},
width=0.7*\textwidth,
height=9cm,
bar width=7pt,
symbolic x coords={Category-1,Category-2},
xtick=data,
ymin=0
]
\addplot
coordinates {(Category-1,0.27) (Category-2,14.96)};
\addplot
coordinates {(Category-1,0.37) (Category-2,13.25)};
\addplot
coordinates {(Category-1,2.76) (Category-2,29.55)};
\addplot
coordinates {(Category-1,2.82) (Category-2,16.03)};
\legend{Original, byHalf, Random, Hybrid}
\end{axis}
\end{tikzpicture}
\end{figure}
\end{document}
두 부분(Category-1과 Category-2)을 서로 더 가깝게 만들려면 어떻게 해야 합니까?
답변1
를 설정하여 플롯 양쪽의 공간을 늘릴 수 있습니다 enlarge x limits=<value>
. enlarge x limits=1
이 경우 설정이 매우 잘 작동합니다.