Method 2: \nodeIt is \path nodethe omission of , which needs to be added here at, that is, as \node at A [attr]{info}; mentioned earlier, [draw]the meaning is and the meaning of drawing. Here [shape=circle]can be abbreviated as[circle]
There is no text in the node, why does the node still have a size? Since TikZthe automatically adds some space around the text inner sep , you can change the [inner sep = 0pt]to modify things like that. But to make sure the node is displayed properly, set its minimum size[minumun size = 6mm]
Then it is to set a unified style [XXX/.style={……}].
Naming the nodes can save convenience for subsequent operations, and there is no need to calculate the coordinate drawing separately. (name), Note that the name cannot have special characters, etc., and can have underscores and hyphens.
TikiZThe syntax is relatively loose for the order of multiple parallel attributes, such as \node [A] (B) at Cor \node (B) [A] at Cand the like.
Many coordinates are given above, in fact, we can also draw by relative position Need to import \usetikzlibrary {positioning}, and then use the following syntax: [below = of name], [right = of name]etc., the distance between them is node distance, the default is the distance between the centers of nodes, or the distance between boundaries distance.
Method 1: Add a node with a surname, set the attribute to [red,above], add it to (semaphore.north)the north of a node, and the text information is{s \e 3}
Multiple labels can also be given. Use here [label=60]to add a label at a position of 60 degrees, [label=-90]to add a label at a position of 270 degrees
Use [every label/.style={}]to modify the label's style.
\tikz
\node [circle,draw,label=60:$60^\circ$,label=below:$-90^\circ$]{
my circle};
Drawing of Linked Edges
Method 1: Use syntax \draw [->] (A.west) -- (B.east)or \draw A .. controls B and C .. Ddraw a curve Here you need to indicate where the starting point is, and where it ends
Method Two: But this is stupid. A simple way of writing is to omit all the above directions, just like the following code. Because TikZit will automatically and intelligently choose the appropriate direction.
\draw [->](enter critical)--(critical);
\draw [->](waiting).. controls +(left:8mm) and +(up:8mm)..(enter critical);
Method 3: Or try a new syntax use \draw [->] A to Binstead of \draw [->] A .. B using to \draw [->] A to [out=B,in=C] Ddraw a curve, that is, the given in,outattribute represents the angle of the arc leaving or entering the coordinate.
\draw [->](enter critical)to(critical);
\draw [->](waiting) to [out=180,in=90](enter critical);
Method 4: Use [bend left=A]to indicate the degree of left/right bend, and you can also draw the corresponding link curve.
\draw [->](waiting) to [bend right=45](enter critical);
Method 5: Syntactic sugar, use \node A edge B edge C……to draw the edges linking point A to point B and point C.
After [上篇]we learned to add information directly above/middle/directly below the line, we use etc. [sloped, below]Here our requirement is to add information on the side[auto] of the line, just use the attribute. Using [swap]the property mirrors drawing on the other side of the line. See code below.
Add \usetikzlibrary {decorations.pathmorphing}library Use [decoration={snake}]to add serpentine lines, you can also change other parameters, such as [amplitude, segment length, post length]etc.
Multi-line text is very simple, LateXsimilar to the syntax, use \\to wrap. You can also use [text width=3cm]to have it automatically segment by text length.
After drawing a picture, it is hoped to add a background rectangle of a certain color behind the background of the picture. Since the size of the graph is dynamic, you can choose to specify the coordinates to draw, or you can use the layer layer . The layer graph needs to import backgroundsthe library, which uses fitthe library, and both need to be imported
Add one scopethat specifies where [on background layer]to draw the background layer to use [fit = A B C D E]to accommodate overlaying these elements.