![如何在組圖中僅列印一次軸描述? (背景:符號 x 座標破壞了「xlabels at=底部邊緣」選項)](https://rvso.com/image/298796/%E5%A6%82%E4%BD%95%E5%9C%A8%E7%B5%84%E5%9C%96%E4%B8%AD%E5%83%85%E5%88%97%E5%8D%B0%E4%B8%80%E6%AC%A1%E8%BB%B8%E6%8F%8F%E8%BF%B0%EF%BC%9F%20%EF%BC%88%E8%83%8C%E6%99%AF%EF%BC%9A%E7%AC%A6%E8%99%9F%20x%20%E5%BA%A7%E6%A8%99%E7%A0%B4%E5%A3%9E%E4%BA%86%E3%80%8Cxlabels%20at%3D%E5%BA%95%E9%83%A8%E9%82%8A%E7%B7%A3%E3%80%8D%E9%81%B8%E9%A0%85%EF%BC%89.png)
我在群組圖中使用符號 x 座標。這證明是有問題的,因為我無法在不丟失xmajorgrid
.我似乎找不到合適的選項。
如何僅停用除最後一行之外的所有繪圖的刻度標籤? (在本例中,只有一個圖/一列)
給關注 pgfplots-tag 的人一個小提示:很抱歉提出了這麼多問題,我似乎在這方面受到了極大的詛咒,即發現許多小事情運行得不太好,並且無法思考問題
圖片
微量元素
\documentclass[
a4paper
]{scrartcl}
\usepackage{
amsmath,
tikz,
pgfplots,
}
\usepgfplotslibrary{
groupplots,
}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\begin{document}
\begin{center}
\begin{tikzpicture}[font=\small]
\begin{groupplot}[
group style={
group size=1 by 3, %Spalte(n) by Zeile(n)
horizontal sep=0cm,
vertical sep=0.2cm,
xlabels at=edge bottom,
yticklabels at=edge bottom,
ylabels at=edge left,
yticklabels at=edge left,
},
%
ymin=0, ymax=30,
%
xlabel={Bla},
ylabel={Process},
%
xmajorgrids=true,
%
scale ticks above exponent={3},
]
\nextgroupplot[
xmin=10, xmax=20,
]
\addplot coordinates{(11,12) (13,15)};
\nextgroupplot[
symbolic x coords={11,13},
xtick=\empty,
]
\addplot[red, dashed] coordinates{(11,8) (13,25)};
\nextgroupplot[
xmin=10, xmax=20,
]
\addplot[orange, thick] coordinates{(11,8) (13,25)};
\end{groupplot}
\end{tikzpicture}
\end{center}
\end{document}
答案1
解決方法
迄今為止我發現的最好的補救措施是使用x tick label style={color=white},
.它的效果相當好,取決於xticklabel
s 的位置。
一個明顯不太令人滿意的解決方法是使用類似的東西來\draw[thin, gray] (rel axis cs:0.33,0) -- (rel axis cs:0.33,1);
繪製網格和相應的命令來繪製刻度線。這可能涉及大量的 T&E 運行。
\documentclass[
a4paper
]{scrartcl}
\usepackage{
amsmath,
tikz,
pgfplots,
}
\usepgfplotslibrary{
groupplots,
}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\begin{document}
\begin{center}
\begin{tikzpicture}[font=\small]
\begin{groupplot}[
group style={
group size=1 by 3, %col(s) by row(s)
horizontal sep=0cm,
vertical sep=0.2cm,
xlabels at=edge bottom,
yticklabels at=edge bottom,
ylabels at=edge left,
yticklabels at=edge left,
},
%
ymin=0, ymax=30,
%
xlabel={Bla},
ylabel={Process},
%
xmajorgrids=true,
%
scale ticks above exponent={3},
]
\nextgroupplot[
xmin=10, xmax=20,
]
\addplot coordinates{(11,12) (13,15)};
\nextgroupplot[
symbolic x coords={11,13},
%xtick=\empty,
x tick label style={color=white}, %<-------------- WORKAROUND HERE
]
\addplot[red, dashed] coordinates{(11,8) (13,25)};
\nextgroupplot[
xmin=10, xmax=20,
]
\addplot[orange, thick] coordinates{(11,8) (13,25)};
\end{groupplot}
\end{tikzpicture}
\end{center}
\end{document}