如何在組圖中僅列印一次軸描述? (背景:符號 x 座標破壞了「xlabels at=底部邊緣」選項)

如何在組圖中僅列印一次軸描述? (背景:符號 x 座標破壞了「xlabels at=底部邊緣」選項)

我在群組圖中使用符號 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},.它的效果相當好,取決於xticklabels 的位置。

一個明顯不太令人滿意的解決方法是使用類似的東西來\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}

相關內容