I want to create a figure with 3 plots, a vertical reference line, and marks at the intersections of each plot with the reference line. The plots come from an external table.
Plotting works, but naming the plot for usage with the intersections library does not. Here is an example:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{intersections}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{loglogaxis}[log basis x=10,log basis y=10]
\addplot[name path=SProPath] coordinates {(1e-1,1e-7) (1e1,1e3)};
\node[coordinate] (Ref) at (axis cs:1,1) {};
\node[coordinate] (RefPathStart) at (Ref |- current axis.south east) {};
\node[coordinate] (RefPathEnd) at (Ref |- current axis.north east) {};
\path[name path=RefPath] (RefPathStart) -- (RefPathEnd);
\fill [red,opacity=0.5,name intersections={of=SProPath and RefPath}]
(intersection-1) circle (2pt);
\end{loglogaxis}
\end{tikzpicture}
\end{document}
I'm getting the following errors:
! Package tikz Error: I do not know the path named `SProPath'. Perhaps you misspelt it.
! Package pgf Error: No shape named intersection-1 is known.
The path SProPath should be known to tikz. Is my way of naming the plot wrong? How can I create intersection between "drawn" paths and plots?
name path globalmake a difference? I remember that Jake posted something related some time ago... – Christian Feuersänger Jul 05 '11 at 16:17name path globaldoes not work either. I'll have to find the problem Jake posted - or can you link to it? It doesn't seem to be tagged withintersections. – Christoph Jul 05 '11 at 17:40name pathtoname path globalseems to work for me. You should also have a look at the link Christian pointed out, and this related quetion on clearing paths named withname path global– Peter Grill Jul 05 '11 at 19:32name path global– Peter Grill Jul 05 '11 at 19:38name path globalindeed solves the problem, but I do not understand why I need to addglobalto the second path name - it is not part of anaddplot. So is this a candidate for an exact duplicate close? – Christoph Jul 05 '11 at 20:18