4

Trying to convert a coment into a complete answer for How do determine the arrow form in Tikz I think that my solution there worked by chance and that MWijnand found a wrong behavior in to path library when {x|y}scale has negative values.

Take a look at this example:

\documentclass[tikz,border=2mm]{standalone}
\usepackage{bondgraph}          
\usetikzlibrary[petri] 

\begin{document}
\begin{tikzpicture}[thin,>=stealth, every place/.style={draw,thick,minimum size=6mm}]
    \node[place] (pG) {$p_G$};
    \node[place,right=3cm of pG] (pR) {$p_R$};
    \draw[->] (pR) to [out=150, in=30] (pG);
    \begin{scope}[yscale=-1]
    \draw[->,blue] (pR) to [out=150, in=30] (pG);
    \end{scope} 
    \begin{scope}[xscale=-1]
    \draw[->,red] (pR) to [out=150, in=30] (pG);
    \end{scope} 
    \begin{scope}[scale=-1]
    \draw[->,green] (pR) to [out=150, in=30] (pG);
    \end{scope} 
\end{tikzpicture}
\end{document}

and its strange result.

enter image description here

What I would expect was that pR.center was the paths origin and pG.center was the path end. The path would have a out angle affected by scale factor and the drawn path would start on corresponding intersection point over pR border. This is what happens with out angle as you can see around pR node.

But this doesn't happen with in angle (pG node). in angle fixes final anchor at pG.30 and not at pG.center as expected. It also changes incidence angle for which scale factor is applied.

I think this is wrong and I'll fill a bug report. If I'm wrong or you have a better solution, please let us know.

2

This is actually how it is supposed to work. The in and out directions are calculated in the current coordinate system.

\documentclass[tikz,border=2mm]{standalone}
\begin{document}
  \begin{tikzpicture}[thin,>=stealth, place/.style={circle, draw,thick,inner sep=1pt}]
    \node[place] (pG) at (-1.5,0) {.};
    \node[place] (pR) at (1.5,0) {.};

    \draw[->] (pR) to [out=150, in=30] (pG);
    \draw (pR) -- +(150:1) (pG) -- +(30:1);

    \begin{scope}[yscale=-1,blue]
      \draw[->] (pR) to [out=150, in=30] (pG);
      \draw (pR) -- +(150:1) (pG) -- +(30:1);
    \end{scope}

    \begin{scope}[xscale=-1,red]
      \draw[->] (pR) to [out=150, in=30] (pG);
      \draw (pR) -- +(150:1) (pG) -- +(30:1);
    \end{scope}

    \begin{scope}[scale=-1,green]
      \draw[->] (pR) to [out=150, in=30] (pG);
      \draw (pR) -- +(150:1) (pG) -- +(30:1);
    \end{scope}
  \end{tikzpicture}
\end{document}

enter image description here

But you can change this behaviour using relative style.

\documentclass[tikz,border=2mm]{standalone}
\begin{document}
  \begin{tikzpicture}[thin,>=stealth, place/.style={circle, draw,thick,inner sep=1pt}]
    \node[place] (pG) at (-1.5,0) {.};
    \node[place] (pR) at (1.5,0) {.};

    \draw[->,relative] (pR) to [out=-30, in=-150] (pG);

    \begin{scope}[yscale=-1,blue]
      \draw[->,relative] (pR) to [out=-30, in=-150] (pG);
    \end{scope}

    \begin{scope}[xscale=-1,red]
      \draw[->,relative] (pR) to [out=-30, in=-150] (pG);
    \end{scope}

    \begin{scope}[scale=-1,green]
      \draw[->,relative] (pR) to [out=-30, in=-150] (pG);
    \end{scope}
  \end{tikzpicture}
\end{document}

enter image description here

  • Thank you fore relative, I didn't know it. But I don't agree with the correctness of first example. I can understand that all arriving angles are correct but I still think that the arriving target should be pG.center and now it's pG.30. Would you mind to include some comment explaining it? – Ignasi Feb 28 '15 at 7:42
  • Very often when mixing named coordinates and transformations, the TikZ guess of the anchor position is not correct. As the manual says "The exact rules are a bit complex, but the chosen point will usually be correct – and when it is not, Hagen can still specify the desired anchor by hand." ;) – Kpym Feb 28 '15 at 7:56
  • You can check my answer here for more related info : tex.stackexchange.com/a/220317/9335 – Kpym Feb 28 '15 at 8:01
  • Thanks again. My conclusion is "use relative when {x|y}scale=-1 is applied". – Ignasi Feb 28 '15 at 8:46
  • @Ignasi you are welcome. My personal taste : "use relative in general" ;) – Kpym Feb 28 '15 at 19:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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