
Я хочу добавить пользовательский интервал к оси 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}