
첨부된 그래프의 x축에 사용자 정의 간격을 추가하고 싶습니다. 20부터 시작하여 5씩 증가해야 합니다. 예를 들어 20, 25, 30, ......50입니다. 이전에도 비슷한 질문이 올라왔으나 답변 없이 종료되었습니다. 미리 감사드립니다. 내 코드는 아래에 설명되어 있습니다.
\begin{figure}[!h]
\begin{centering}
%\begin{adjustwidth}{-1.5cm}{}
\begin{tikzpicture}
\begin{axis}[
footnotesize,
xbar,
width=11.0cm, height=4.5cm,
enlarge y limits=0.01,
enlargelimits=0.07,
%xlabel={\#participants},
symbolic y coords={Al, Stor, Pro, Ser, Domain, Services},
ytick=data,
nodes near coords, nodes near coords align={horizontal},
every node near coord/.append style={font=\footnotesize},
]
\addplot coordinates {
(48,Services) (27,Domain) (26,Ser) (25,Pro) (23,Stor) (37,All)};
\end{axis}
\end{tikzpicture}
\caption{Design}
%\end{adjustwidth}
\label{fig:SQ21}
\end{centering}
\end{figure}
답변1
질문 아래의 설명에서 이미 언급한 대로 원하는 것을 달성하려면 옵션 에 xmin=20
및 를 추가하기만 하면 됩니다.xtick distance=5
axis
% used PGFPlots v1.17
\documentclass[border=5pt]{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
footnotesize,
xbar,
width=11.0cm, height=4.5cm,
% ---------------------------------------------------------------------
% added
xmin=20,
xtick distance=5,
% ---------------------------------------------------------------------
enlarge y limits=0.01,
enlargelimits=0.07,
symbolic y coords={All, Stor, Pro, Ser, Domain, Services},
ytick=data,
nodes near coords,
nodes near coords align={horizontal},
every node near coord/.append style={font=\footnotesize},
]
\addplot coordinates {
(48,Services) (27,Domain) (26,Ser) (25,Pro) (23,Stor) (37,All)
};
\end{axis}
\end{tikzpicture}
\end{document}