아래 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]
\begin{tikzpicture}
\begin{axis}[%
scaled y ticks = true,
width=1*\textwidth,
height=8cm,
xlabel={Query},
ylabel={Elapsed Time (in seconds)},
xmajorgrids,
ymajorgrids,
zmajorgrids,
enlarge x limits=0,
scaled x ticks = true]
\addplot [
color=red,
solid,
line width=1.0pt
]
coordinates{
(0,10)
(1,4)
(2,5)
};
\end{axis}
\end{tikzpicture}
\caption{Blah}
\end{figure}
\end{document}
그리드를 더 세밀하게 만들려면 어떻게 해야 합니까?
답변1
각 축 그리드의 스타일을 정의할 필요가 없습니다. grid=major
한 번에 모두 설정합니다. 또한 더 미세한 그리드를 얻으려면 작은 틱을 도입해야 하며 grid=both
그 수단을 minor
사용할 수 있습니다 major
. 다음이 충분하지 않은 경우 y
축이나 옵션 에 대해 동일한 작업을 수행할 수 있습니다 minor tick
.
\documentclass{report}
\usepackage[left=2.5cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage[T1]{fontenc}
%\usepackage{tikz,pgf} %Pgfplots loads TikZ, and TikZ loads PGF by default
\usepackage{pgfplots}
%================================ You don't need all this for the MWE
\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]
\begin{tikzpicture}
\begin{axis}[%
scaled y ticks = true,
width=\textwidth,
height=8cm,
xlabel={Query},
ylabel={Elapsed Time (in seconds)},
grid=both,
ticks=both,
minor xtick={0,0.1,...,2},
enlarge x limits=0,
scaled x ticks = true
]
\addplot [
color=red,
solid,
line width=1.0pt
]
coordinates{
(0,10)
(1,4)
(2,5)
};
\end{axis}
\end{tikzpicture}
\caption{Blah}
\end{figure}
\end{document}