pgfplot barchart가 x축을 위로 이동합니다.

pgfplot barchart가 x축을 위로 이동합니다.

아래 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.8*\textwidth,
height=9cm,
bar width=7pt,
symbolic x coords={Category-1,Category-2,Category-3},
xtick=data,
%nodes near coords,
%nodes near coords align={vertical},
]
        \addplot
        coordinates {(Category-1,0.14) (Category-2,2) (Category-3,13.25)};
        \addplot
        coordinates {(Category-1,2.76) (Category-2,2) (Category-3,29.55)};
        \addplot
        coordinates {(Category-1,2.81) (Category-2,2) (Category-3,16.04)};
        \legend{byHalf, Random, Hybrid}
    \end{axis}
\end{tikzpicture}
\end{figure}

\end{document}

X-라벨이 막대에 닿도록 위로 이동하려면 어떻게 해야 합니까?

여기에 이미지 설명을 입력하세요

답변1

본문의 제목과 질문의 불일치가 있는 것 같습니다. 제목에 제기된 질문에 답하고 있습니다.

ymin=0에 추가하면 axis다음을 얻게 됩니다.

여기에 이미지 설명을 입력하세요

암호:

\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.8*\textwidth,
height=9cm,
bar width=7pt,
symbolic x coords={Category-1,Category-2,Category-3},
xtick=data,
%nodes near coords,
%nodes near coords align={vertical},
]
        \addplot
        coordinates {(Category-1,0.14) (Category-2,2) (Category-3,13.25)};
        \addplot
        coordinates {(Category-1,2.76) (Category-2,2) (Category-3,29.55)};
        \addplot
        coordinates {(Category-1,2.81) (Category-2,2) (Category-3,16.04)};
        \legend{byHalf, Random, Hybrid}
    \end{axis}
\end{tikzpicture}
\end{figure}

\end{document}

관련 정보