3

I am trying to intersect a path with a curve in pgfplots.

\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.12}
\usetikzlibrary{intersections}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
xlabel=x, ylabel=y,
xmin = -10, xmax = 10, ymin = -10, ymax =10, 
width=5cm, height=5cm, 
scale only axis=true,
]
\addplot[name path=linieA, domain=-10:10, samples=1000]{0};
\path [name path= linieB] (axis cs: 0,-10) -- (axis cs: 0,10);
\draw [name intersections={of=linieA and linieB,by=E}];
\draw[latex-, ultra thick] (E) -- (10,10);

\end{axis}
\end{tikzpicture}
\end{document}

The code produces error: "! Package pgf Error: No shape named intersection-1 is known."

However upon decreasing the sample number to 100, it compiles nicely. width and height also play: for sample=100 and width,height=0.5cm the same error returns.

Do I have to thin out my data, or is there a better way of finding the intersection points?

Thanks in advance, Stefan.

pgfplots v1.12 tikz v2.10

2
  • The same error happens with pgfplots 2016/01/06 v1.13 and tikz/pgf 2015/08/07 v3.0.1a
    – egreg
    Mar 17, 2016 at 15:16
  • 1
    The MWE works with an up-to-date system with both compat=1.12 and compat=1.18. Sep 26, 2022 at 9:00

0

Browse other questions tagged .