
添付のグラフの 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}