如果我尝试通过提供相同的 y 坐标来水平对齐两个节点,$D_{\textrm{X-ray}}$
则文本$D_{\textrm{C-ion}}$
仍然无法正确对齐,这显然与下标的字母高度有关。删除[above]
标签不会改变该行为。如何将两个节点与 D 对齐?在 pgfplots 中正确对齐基线上的垂直文本处理类似的问题,但我不知道如何将解决方案应用到我的示例。
\begin{figure}[ht]
\centering
\begin{tikzpicture}
\begin{semilogyaxis}[samples=200,ymin=0.001,ymax=1,xmin=0,xmax=5,unbounded coords=discard,xlabel=Dose (Gy),
ylabel=Survival,
legend entries={X-rays, Carbon ions},
legend style={draw=none, nodes=right},
legend pos= north east]
\addplot [thick, dashed] plot (\x, {1*(exp((-0.8*\x)-(0.12*\x*\x)))});
\addplot [thick] plot (\x, {1*(exp((-2*\x)))});
\draw[semithick] (axis cs:0,0.01) -> (axis cs:2.302,0.01);
\draw (axis cs:0,0.0095) -- (axis cs:3.701,0.0095);
\node[above] at (axis cs:0.5,0.01) {\small $D_{\textrm{C-ion}}$};
\node[above] at (axis cs:2.8,0.01) {\small $D_{\textrm{X-ray}}$};
\draw[semithick] (axis cs:2.302,0.01) -- (axis cs:2.302,0.001);
\draw (axis cs:3.701,0.0095) -- (axis cs:3.701,0.001);
\node at (axis cs:1.15,0.003) {\small $\textrm{RBE} = \frac{3.7\textrm{ Gy}}{2.3\textrm{ Gy}} \approx 1.6$};
\end{semilogyaxis}
\end{tikzpicture}
\end{figure}
答案1
字母的下行部分y
将节点向上推。您可以放入\vphantom{y}
C-ion 文本以保留垂直空间,也可以text depth=3pt
在节点中添加选项以保留下行部分的空间(或其他合适的值)。