Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

If I try to horizontally align two nodes by giving the same y-coordinate, the text $D_{\textrm{X-ray}}$ and $D_{\textrm{C-ion}}$ is still not aligned properly, which has apparently to do with the letter height of the subscripts. Removing [above] tag does not change that behaviour. How do I align both nodes to the D? Correctly align vertical text on a baseline in pgfplots deals with a similar issue, but I don't know how to apply the solution to my example.

enter image description here


\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}
share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

The descender of the letter y is pushing the node up. You can either put \vphantom{y} inside the C-ion text to reserve the vertical space or you can add text depth=3pt option in your nodes to reserve space for the descenders (or some other suitable value).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.