# how to have more control on the anchor location of a node other than defaults?

A tikz node has anchor points south, north etc.. also south west and south east etc...

But in this diagram below, I'd like to draw a line from a node starting not at exactly south west but half way between south west and south. i.e. shifted more to to the right from the south west corner so it looks better.

How does one create a new anchor location in general to use to draw lines from other than those buildin?

An example will make this clear. This MWE

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\usetikzlibrary{positioning}
\begin{document}
\pagestyle{empty}

\tikzstyle{block} = [rectangle, draw, fill=blue!20,
text width=5em, text centered, rounded corners, minimum height=4em]
\tikzstyle{line} = [draw, -latex']

\begin{tikzpicture}
% Place nodes
\node [block] (init) {differential equation};
%
\node [block, below right=1cm and -1.5cm  of init] (secondOrder) {second order};
%
\node [block, below=1cm of secondOrder] (linearSecondOrder) {linear};
\node [block, right=1cm of linearSecondOrder] (nonlinearSecondOrder) {non-linear};
%
\node [block, below left=1cm and 1cm  of init] (firstOrder) {first order};
%
\node [block, below=1cm of firstOrder] (firstOrderDegree1) {degree 1};
%
\node [block, below right=.5cm and -1.2cm of firstOrderDegree1] (linearFirstOrder) {linear};
\node [block, below=.5cm of linearFirstOrder]  (separable) {separable};
\node [block, below=.5cm of separable]   (bernoulli) {Bernoulli};
%
\node [block, left=1cm of firstOrderDegree1] (firstOrderDegreeHigher) {higher degree};
%
\node [block,   below right=1cm and 4.5cm of init] (higherOrder) {higher order};

\path [line] (init) -- (firstOrder);
\path [line] (init) -- (secondOrder);
\path [line] (init) -- (higherOrder);
%
\path [line] (secondOrder) -- (linearSecondOrder);
\path [line] (secondOrder) -- (nonlinearSecondOrder);
%
\path [line] (firstOrder) -- (firstOrderDegree1);
\path [line] (firstOrder) -- (firstOrderDegreeHigher);
%
\path [line] (firstOrderDegree1.south west) -- (linearFirstOrder.west);
\path [line] (firstOrderDegree1.south west) -- (separable.west);
\path [line] (firstOrderDegree1.south west) -- (bernoulli.west);
\end{tikzpicture}
\end{document}

Generates this

Actually what I'd like to do is the following, but I think this is harder so I am try first to see if I can change the anchor location first:

The above is better, but I do not know how do the above, since I do not know the locations to draw the lines from/to. So I'll settle for the first choice for now if possible.

• With forrest is easy. See examples in tex.stackexchange.com/questions/649172, tex.stackexchange.com/questions/635418 or tex.stackexchange.com/questions/641950. Commented Nov 22, 2022 at 10:23
• @Zarko Thanks, I knew about forest but did not use it much, may be one time. I wanted first to see if I can do all this directly without using external packages such as forest or tree as this way I have more control of things and how to arrange things. If this does not work, will try forest or tree packages. Commented Nov 22, 2022 at 10:27
• Nodes have "degree anchors". For example <node>.210 means: At the point on the border where a line would cross that starts form the center of the node, rotated by 210 degrees (where 0 degrees is identical to east). In your case, firstOrderDegree1.240 could maybe work, since firstOrderDegree1.270 would be the same as firstOrderDegree1.south. Commented Nov 22, 2022 at 10:28
• You can use the " vertical/horizontal line-to" operator |- (there is also -|). Combine this with a "degree anchor" and you would get \path [line] (firstOrderDegree1.220) |- (linearFirstOrder.west);. This first draws a vertical line that starts at firstOrderDegree1.220 and then adds a horizontal line to linearFirstOrder.west. Commented Nov 22, 2022 at 10:42
• How much to the right? An absolute length? → ([xshift=<value>]<name>.south west). A relative length, say halfway between .south west and .south? → ($(<name>.south west)!.5!(<name>.south)$). The answers to Q247821 show some PGF solutions that add special anchors. Commented Nov 22, 2022 at 10:43

Here is an option using forest.

\documentclass{article}

\usepackage[edges]{forest}

\begin{document}

\begin{forest}
for tree={
draw, rounded corners, fill=blue!20,
minimum height=1.5cm, minimum width=2cm,
align=center, base=b,
s sep=1cm, l sep=.5cm,
if level<=2{edge=-latex}{edge=red},
}
[differential\\equation
[first order, calign=last
[higher\\degree][degree 1, for tree={grow'=0, folder}, s sep=.5cm, before computing xy={l-=.845cm}
[linear][separable][Bernoulli]
]
]
[second order, calign=first
[linear][nonlinear]
]
[higher order, fit=band]
]
\end{forest}

\end{document}