가로축의 간격

가로축의 간격

첨부된 그래프의 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=5axis

% 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}

위 코드의 결과를 보여주는 이미지

관련 정보