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.
forrest
is easy. See examples in tex.stackexchange.com/questions/649172, tex.stackexchange.com/questions/635418 or tex.stackexchange.com/questions/641950.<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 toeast
). In your case,firstOrderDegree1.240
could maybe work, sincefirstOrderDegree1.270
would be the same asfirstOrderDegree1.south
.|-
(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 atfirstOrderDegree1.220
and then adds a horizontal line tolinearFirstOrder.west
.([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.