Understanding nodes
In TikZ, a node is a piece of text that can have a specific shape. By default, nodes have a rectangular shape, but we can choose between many other shapes, such as circles, ellipses, polygons, stars, clouds, and many more. Using shapes other than rectangles and circles requires loading the shapes
library. So, from now on, we will add this line to our TikZ documents:
\usetikzlibrary{shapes}
Let’s start with elementary examples. We can place a simple piece of text on the coordinates x=4 and y=2 with the following command:
\draw (4,2) node {TikZ};
It gives us just the word TikZ
at the position (4,2). When we want TikZ to also draw the border, we add the draw
option to the node:
\draw (4,2) node[draw] {TikZ};
We can choose a border color, fill it with a color, and choose a text color, for example:
\draw (4,2) node[draw, color=red, fill=yellow, text=blue] {TikZ};
What started as simple text now looks like this: