向上移動後 y 軸標記與軸斷開

向上移動後 y 軸標記與軸斷開

正如你所看到的,我已經將第二個軸向上移動了。不過,我想修復零,因為它已與 y 軸斷開。

在此輸入影像描述

\begin{tikzpicture}[scale=1.5]

\begin{axis}[
date coordinates in=x,
width=12cm,height=5.5cm, scale only axis,
xticklabel style={align=center, rotate=90, anchor=near xticklabel},
major x tick style = transparent,
ymin=0,
ymax=6,
ytick={0,1,2,3,4,5}
]
\end{axis}

\begin{axis}[
yshift=7cm, 
anchor=north west,
width=12cm,height=1.5cm, scale only axis,major x tick style = transparent,
minor x tick num = 0,
xticklabels={,,}]

\end{axis}
\end{tikzpicture}

答案1

我懷疑您至少需要修復第二個軸的 y 下限,即添加ymin=0到您的軸。

如果您的軸都是空的,您可能會看到一條警告,聲稱

! Package pgfplots Warning: You have an axis with empty range. Replacing it with a default range and clearing all plots.

在這種情況下,您必須手動提供受影響軸的所有限制。

相關內容