Home > tikz pgf > Consistency in the appearances of loops from rectangular nodes

Consistency in the appearances of loops from rectangular nodes

February 27Hits:2
Advertisement

I would like to have a left-positioned loop "look the same" as a below-positioned loop emanating from a rectangular node.

\documentclass{article} \usepackage{tikz}  \tikzstyle{rect} = [rectangle, rounded corners, minimum width=3cm, minimum       height=1cm,text centered, draw=black, fill=red!30]   \begin{document}  \begin{tikzpicture}  \node (A) (r) [rect] {Rectangle};  \path[->] (r) edge  [loop below] node {Below} ();  \path[->] (r) edge  [loop left] node {Left} ();  \end{tikzpicture}  \end{document} 

Consistency in the appearances of loops from rectangular nodes

For example the left loop is fatter and bigger. I want it to start and finish in the middle of the left-vertical side of the rectangle and be of the same size/shape as the lower loop.

Thanks

Ron

Ans:

As per Harish Kumar's answer (with some minor configurations)

\begin{tikzpicture} \node (r) [rect] {Rectangle}; \path[->] (r) edge  [loop below] node {Below} (); \path[->] (r.185) edge  [out=195, in=170,distance=0.8cm] node[anchor=east] {Left}(r.175); \end{tikzpicture} 

Consistency in the appearances of loops from rectangular nodes

Answers

Both the loops set their origin from the center of the node while calculating parameters and since the width and height of the node is different, they come out in different sizes. You may draw the loops by yourselves in such cases.

\documentclass{article}
\usepackage{tikz}

\tikzstyle{rect} = [rectangle, rounded corners, minimum width=3cm, minimum       height=1cm,text centered, draw=black, fill=red!30]

 \begin{document}
 \begin{tikzpicture}
 \node[draw,minimum size=1cm] (a){};
 \path[->] (a) edge  [loop below] node {Below} ();
 \path[->] (a) edge  [loop left] node {Left} ();
 \end{tikzpicture}
 \begin{tikzpicture}
 \node (A) (r) [rect] {Rectangle};
 \path[->] (r.300) edge  [out=300,in=240,distance=1.5cm]node[anchor=north] {Below} (r.240) ;
 \path[->] (r.190) edge  [out=190,in=170,distance=1.5cm] node[anchor=east] {Left} (r.170);
 \end{tikzpicture}
 \end{document}

Consistency in the appearances of loops from rectangular nodes

You may have to adjust the looseness/tension to make them exactly similar.

Tags:nodes, tikz pgf

Related Articles

  • Consistency in the appearances of loops from rectangular nodes

    Consistency in the appearances of loops from rectangular nodesFebruary 27

    I would like to have a left-positioned loop "look the same" as a below-positioned loop emanating from a rectangular node. \documentclass{article} \usepackage{tikz} \tikzstyle{rect} = [rectangle, rounded corners, minimum width=3cm, minimum height

  • Centering ellipses inside a rectangular node

    Centering ellipses inside a rectangular nodeSeptember 7

    The following TikZ picture consists of a rectangle containing two ellipses. I'm constructing this by putting a TikZ picture environment inside the node of an including TikZ picture environment. I've seen this idiom used before, but it doesn't seem pa

  • Why does a while loop block the node event loop?January 16

    The following example is given in a Node.js book: var open = false; setTimeout(function() { open = true }, 1000) while (!open) { console.log('wait'); } console.log('open sesame'); Explaining why the while loop blocks execution, the author says: Node

  • How can I draw two loops above a node?

    How can I draw two loops above a node?December 26

    How can I draw two loops above a node? Here is my code: \path (r) edge[loop above] node[left=1pt] {3} (r); \path (r) edge[out=140, in=50, looseness=0.8, loop] node[above=3pt] {4} (r); How can I make the 2nd loop bigger, so that I get more space in be

  • Properly aligning drawn lines between the corners of 2 rectangular nodes in TikZ?

    Properly aligning drawn lines between the corners of 2 rectangular nodes in TikZ?September 29

    When I draw a thick line from the corner of one box to the same corner of another, it doesn't attach properly. See the code and picture below: \documentclass[a4paper, 11pt]{article} \usepackage{tikz} \usetikzlibrary{shapes,arrows} \usetikzlibrary{pos

  • Left and right align inside one TiKZ rectangular node

    Left and right align inside one TiKZ rectangular nodeMay 9

    I'd like to create a PID controller block diagram similar to the one here. At the moment my diagram looks as depicted below. What I still need is to right-and-left align the text inside the rectangular nodes, i.e. I'd like the letters P, I, D to be l

  • Adding extra nodes at anchors of rectangular node custom shape in tikz?

    Adding extra nodes at anchors of rectangular node custom shape in tikz?April 22

    I want to make a node which will be a SPDT switch symbol, which looks like this: So, I thought, I could start by deriving a custom shape from a rectangular node, whose size will be set by minimum width/height; then I could add small circular nodes at

  • Creating Multiple-State Models (rectangular nodes)

    Creating Multiple-State Models (rectangular nodes)July 24

    I would like to replicate the following image for my work: I now have the following MWE: \documentclass[12pt]{article} \usepackage[margin=2cm]{geometry} \usepackage [english]{babel} \usepackage{amsmath, amssymb} \usepackage{tikz} \usetikzlibrary{posi

  • How to connect to the corner of a rectangular node with a thick line without overlap?

    How to connect to the corner of a rectangular node with a thick line without overlap?May 13

    I would like to connect a thick line with the corner of a rectangular node. \documentclass[tikz]{standalone} \begin{document} \begin{tikzpicture} \node (rect) at (0,0) [draw,minimum width=2cm,minimum height=2cm,gray]{Rectangle}; \draw[-,line width=2m

  • Define a new rectangular node with several anchor points in tikz

    Define a new rectangular node with several anchor points in tikzMay 30

    I'd like to define a new node (or maybe a new shape) with many anchor points. In particular I need of a rectangular shape with up to 15 anchor points on the top and the bottom of the rectangle. That's because I'd like to draw something like this easi

  • Draw rectangular nodes defined by opposing corner coordinates with vertically centered text

    Draw rectangular nodes defined by opposing corner coordinates with vertically centered textJuly 14

    I've got some coordinates in a tikz-picture and I'd like to draw some rectangles defined by two opposing corner coordinates. The seemingly easiest way to do that I found with this answer: Placing a rectangular node in tikz by specifying two opposing

  • Using foreach loop variable as node label in pgfplots

    Using foreach loop variable as node label in pgfplotsApril 2

    I have a (multi)line plot generated from a table in pgfplots: \begin{document} \begin{tikzpicture} \begin{axis} \pgfplotstableread{table.tsv}\loadedtable \foreach \metavar in {foo,bar} { \addplot table[x index=1,y=\metavar] from \loadedtable node {\m

  • TikZ multiple loops on one node

    TikZ multiple loops on one nodeMarch 5

    I am attempting to draw a single node with several loops, of various sizes, positions, and labels on them. I can do some rough work on it, although it has a few problems. I looked at the documentation for loops in the manual (52.4 Loops). This got me

  • Placing a rectangular node in tikz by specifying two opposing corners

    Placing a rectangular node in tikz by specifying two opposing cornersJune 14

    In \documentclass[border=10pt]{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture} \coordinate (bottom left) at (10,10); \coordinate (top right) at (20,20); \draw[rounded corners,fill=black] (bottom left) rectangle (top right); \end{ti

  • Loop through all nodes with rules

    Loop through all nodes with rulesDecember 19

    I have a content type (called Contact List) and by using Rules module I want to check if there is a specific phone number in my nodes, I get the node id and use it in the other content type (called Products which has an Entity Reference field that po

  • Looping when using node js require()?February 15

    Currently i have define require file as below. constantPath = './config/file/' fileAA = require(path.resolve(constantPath + 'A-A')), fileBB = require(path.resolve(constantPath + 'B-B')), fileCC = require(path.resolve(constantPath + 'C-C')), .... ....

  • SwiftyJSON - How to loop through child nodes when parsingFebruary 17

    I have the below JSON structure that I'm attempting to parse using SwiftyJSON, but I can't work out how to loop through the "sections" node. The code I currently have returns the first section node for each section, but I can't access the "

  • How to draw a tree diagram where its rectangular nodes have a floating numbering label each?

    How to draw a tree diagram where its rectangular nodes have a floating numbering label each?May 31

    This is a graph someone send me in Word: Ignoring the Hebrew text, how can I produce such a graph in LaTeX (I actually use LyX, but I suppose it won't help me so much)? If there's an elegant and easy way to add the numbering as well, that will be gre

  • Align both left and right edge of a rectangular node to given nodes

    Align both left and right edge of a rectangular node to given nodes July 19

    I have the two PGF nodes foo and bar positioned in a row. \documentclass{article} \usepackage{tikz} \usetikzlibrary{positioning} \begin{document} \begin{tikzpicture}[node distance=0.2cm,mynode/.style={rectangle,draw}] \node[mynode] (foo) {foo}; \node

  • TikZ rectangular node with different rounded corners

    TikZ rectangular node with different rounded cornersOctober 27

    This is my minimal example: \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \node[rounded corners=3pt, draw, fill=red!20]{Hallo!}; \end{tikzpicture} \end{document} I'd like to define different values for rounded corners

Copyright (C) 2018 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.534 s.