I'm trying to draw an arc (the top half of a circle of radius 8, centered at (-8,0)) but I can't figure out how to specify the radius in pgfplots's coordinate system. Here's a MWE:
\pgfplotsset{compat=1.5.1}
\begin{tikzpicture}
\begin{axis}[
xmin=-20,xmax=20,
]
\addplot{x}; % not important, just to make things show up
\draw (axis cs:-16,0) arc[start angle=180, end angle=0,
radius=8];
\end{axis}
\end{tikzpicture}
I read about axis direction cs
in the pgfplots manual, but it doesn't explain how to use it to calculate a distance like a radius — it only says that for ellipses, it's done automatically. But I don't have an ellipse, I have an arc.
How can I specify a radius of 8 for my arc, using the coordinate system of my plot?
Best Answer
You can transform the distance for the
radius
using the functiontransformdirectionx
(which is the math parser equivalent to\pgfplotstransformdirectionx
):