Some transition labels from my graph are far from the transition arrow.
(see picutre and source code)
How can I fix this ?
digraph summary {
nodesep=1.0
graph [splines=ortho, nodesep=3.0]
node [height=2, width=3, fixedsize=true]
front_office [label="dématia front office",shape=box, style=filled, fillcolor=lightblue]
autorise [label="autorisé:\n- campagne ouvert + délai\l- login succès\l- diplômé authorisé (IS ou prog)",shape=diamond, style=filled, fillcolor=lightyellow]
premiere_connexion [label="première connexion\n(pas de dossier dematia actif)",shape=diamond, style=filled, fillcolor=lightyellow]
origine [label="origine",shape=diamond, style=filled, fillcolor=lightyellow]
rejet [label="rejet",shape=box, style=filled, fillcolor=lightblue]
creation_pre [nojustify=true label="création pré:\n-étudiant\l-individu\l-historique\l-inscription\l...",shape=box, style=filled, fillcolor=lightblue]
front_office->autorise
autorise->premiere_connexion [label="OUI"]
autorise->rejet [label="NON"]
origine->creation_pre[label="①précandidat éxiste\n(candidat parcoursup)"]
origine->creation_pre[label="②progression éxiste\n(candidat unc)"]
premiere_connexion->origine [label="OUI"]
}
dot gave this error
Warning: Orthogonal edges do not currently handle edge labels. Try
using xlabels.
Changing most of the edge labels to xlabels:
digraph summary {
nodesep=1.0
graph [splines=ortho, nodesep=3.0]
node [height=2, width=3, fixedsize=true]
front_office [label="dématia front office",shape=box, style=filled, fillcolor=lightblue]
autorise [label="autorisé:\n- campagne ouvert + délai\l- login succès\l- diplômé authorisé (IS ou prog)",shape=diamond, style=filled, fillcolor=lightyellow]
premiere_connexion [label="première connexion\n(pas de dossier dematia actif)",shape=diamond, style=filled, fillcolor=lightyellow]
origine [label="origine",shape=diamond, style=filled, fillcolor=lightyellow]
rejet [label="rejet",shape=box, style=filled, fillcolor=lightblue]
creation_pre [nojustify=true label="création pré:\n-étudiant\l-individu\l-historique\l-inscription\l...",shape=box, style=filled, fillcolor=lightblue]
front_office->autorise
autorise->premiere_connexion [xlabel="OUI"]
autorise->rejet [xlabel="NON"]
origine->creation_pre[label="précandidat éxiste\n(candidat parcoursup)"]
origine->creation_pre[xlabel="progression éxiste\n(candidat unc)"]
premiere_connexion->origine [xlabel="OUI"]
}
Gives:
Related
\documentclass[12pt]{article}
\usepackage{tikz-er2}
\usepackage[landscape,margin=1cm]{geometry}
%\usepackage{lscape}
\usetikzlibrary{shadows,positioning}
\begin{document}
\tikzset{every entity/.style = {top color=purple,bottom color=yellow!30,draw=blue!50!black!100,drop shadow},
every attribute/.style = {top color=white, bottom color=yellow!20,draw=yellow, drop shadow},
every relationship/.style = {top color=white, bottom color=red!20,draw=red!50!black!100, drop shadow},
every edg/.style={link},
every isa/.style = {top color=white, bottom color=green!20,draw=green!50!black!100, drop shadow}
}
%\begin{landscape}
\resizebox{0.8\textwidth}{!}{%
\begin{tikzpicture}[scale=0.5];
\node[entity] (Artist) {Artist};
\node[attribute](AID)[above right= 1cm of Artist]{\key{Artist\_ID}};
\node[attribute](Name)[below = 1cm of Artist]{Name};
\node[attribute](Bplace)[above = 1cm of Artist]{Birthplace};
\node[attribute](age)[left = 1cm of Artist]{age};
\node[entity] (ArtFacts) [above right = 2em of Artist ] {ArtFacts} edge (Artist);
\node[attribute](AI)[right= 1cm of Artist]{\key{Art\_ID}};
\node[attribute](AID[below = 1cm of ArtFacts]{Artist\_ID};
\node[derived attribute](year)[above = 1cm of ArtFacts]{Year Created};
\node[attribute](title)[above left = 1cm of ArtFacts]{title};
\node[attribute](Price)[right = 1cm of ArtFacts]{price};
\node[attribute](medium)[below right = 1cm of ArtFacts]{medium};
\end{tikzpicture}
}
%\end{landscape}
\end{document}
Trying to create an ER diagram for an art management project. Running into compiling errors when I start 2nd entity and attributes. the first part runs correctly
(AID is missing the closing parenthesis
\documentclass[12pt]{article}
\usepackage{tikz-er2}
\usepackage[landscape,margin=1cm]{geometry}
%\usepackage{lscape}
\usetikzlibrary{shadows,positioning}
\begin{document}
\tikzset{every entity/.style = {top color=purple,bottom color=yellow!30,draw=blue!50!black!100,drop shadow},
every attribute/.style = {top color=white, bottom color=yellow!20,draw=yellow, drop shadow},
every relationship/.style = {top color=white, bottom color=red!20,draw=red!50!black!100, drop shadow},
every edg/.style={link},
every isa/.style = {top color=white, bottom color=green!20,draw=green!50!black!100, drop shadow}
}
%\begin{landscape}
\resizebox{0.8\textwidth}{!}{%
\begin{tikzpicture}[scale=0.5];
\node[entity] (Artist) {Artist};
\node[attribute](AID)[above right= 1cm of Artist]{\key{Artist\_ID}};
\node[attribute](Name)[below = 1cm of Artist]{Name};
\node[attribute](Bplace)[above = 1cm of Artist]{Birthplace};
\node[attribute](age)[left = 1cm of Artist]{age};
\node[entity] (ArtFacts) [above right = 2em of Artist ] {ArtFacts} edge (Artist);
\node[attribute](AI)[right= 1cm of Artist]{\key{Art\_ID}};
\node[attribute](AID)[below = 1cm of ArtFacts]{Artist\_ID};
\node[derived attribute](year)[above = 1cm of ArtFacts]{Year Created};
\node[attribute](title)[above left = 1cm of ArtFacts]{title};
\node[attribute](Price)[right = 1cm of ArtFacts]{price};
\node[attribute](medium)[below right = 1cm of ArtFacts]{medium};
\end{tikzpicture}
}
%\end{landscape}
\end{document}
I'm plotting a graph in dot. In order to make it legible I need to fine-tune the placement of the edge labels, as well as (if possible) making certain edges straight while others are curved. I would appreciate general advice on how to accomplish these things in dot, but for the sake of concreteness I include my specific problem below.
Here is the code, followed by what it currently looks like:
digraph myGraph {
rankdir=BT;
splines=line;
"AB.BC" -> "AB.AC.BC" [weight=4]
"AB.BC" -> "ABC" [color=red,style=dashed,label="I(A;C|B)"]
"A.B.C" -> "A.BC" [color=red, label="I(B;C)"]
"A.B.C" -> "AC.B" [color=red, label="I(A;C)"]
"A.B.C" -> "AB.C" [color=red, label="I(A;B)"]
"A.BC" -> "AB.BC" [color=red, label="I(A;B)"]
"A.BC" -> "AC.BC" [color=red, label="I(A;C)"]
"AB.AC.BC" -> "ABC" [weight=4]
"AC.B" -> "AC.BC" [color=red, label="I(B;C)"]
"AC.B" -> "AB.AC" [color=red, label="I(A;B)"]
"AC.BC" -> "AB.AC.BC" [weight=4]
"AC.BC" -> "ABC" [color=red,style=dashed, label="I(A;B|C)"]
"AB.AC" -> "AB.AC.BC" [weight=4]
"AB.AC" -> "ABC" [color=red,style=dashed, label="I(B;C|A)"]
"AB.C" -> "AB.BC" [color=red, label="I(A;B)"]
"AB.C" -> "AB.AC" [color=red, label="I(A;C)"]
}
This is close to what I want, but it has a few problems:
The labels are placed in such a way that you can't easily see which one is associated with which edge
For some reason, some of the edges have a bend in them at the label. (They came out as straight lines before I added the labels.)
I've tried playing with the rowsep and nodesep attributes but wasn't able to improve it. If I remove the splines=line line it becomes legible but isn't really what I want:
It's fine for the dotted edges to be curved -- it's actually good, because it will prevent them from overlapping the second node from the top -- but the solid ones really should be straight.
I'd like any advice on how to fine tune node, edge and label placement (as the documentation is really unhelpful and good examples are hard to find), but specifically, my questions are:
Can I tell dot to make specific edges curved while keeping others straight? (I know there is a splineType edge attribute, but the documentation doesn't give me a clue how to use it and I'm not even sure this is what it does.)
If the above is not possible, how can I tell dot to make the straight lines dead straight, rather than bending at the label?
For straight edges, how can I fine tune the placement of the labels? I don't mind doing it by hand, and there seem to be several edge attributes that should help me do that, but none of them seem to have any effect whatsoever, so I must be doing something wrong.
As a bonus question: is there a way that I can give the nodes a more grid-like layout, so that they're nicely vertically aligned?
Any answer is appreciated, but most especially helpful would be answers that explain how to handle these issues more generally, for the sake of future visitors, rather than just fixing my code.
If you use the neato layout engine, you can set the nodes explicit coordinates with attribute pos="x,y". In dot layout engine this is possible by using {rank=same; node1; node2; ...} for vertical alignment and group attribute (node1[group=g1]; node3[group=g1];) for horizontal alignment.
The position of the labels can be changed using the attributes headlabel and taillabel.
Image:
Script:
digraph myGraph {
layout=neato
splines=true
rankdir=BT
node [pin=true]
"A.B.C" [pos="0,0"]
"AC.B" [pos="0,2"]
"A.BC" [pos="-2,2"]
"AB.C" [pos="2,2"]
"AC.BC" [pos="-2,4"]
"AB.BC" [pos="0,4"]
"AB.AC" [pos="2,4"]
"AB.AC.BC" [pos="0,6"]
"ABC" [pos="0,8"]
"AB.BC" -> "AB.AC.BC"
"AB.BC" -> "ABC" [color=red,style=dashed,taillabel="I(A;C|B)"]
"A.B.C" -> "A.BC" [color=red, label="I(B;C)"]
"A.B.C" -> "AC.B" [color=red, label="I(A;C)"]
"A.B.C" -> "AB.C" [color=red, label="I(A;B)"]
"A.BC" -> "AB.BC" [color=red, taillabel="I(A;B)"]
"A.BC" -> "AC.BC" [color=red, taillabel="I(A;C)"]
"AB.AC.BC" -> "ABC"
"AC.B" -> "AC.BC" [color=red, taillabel="I(B;C)"]
"AC.B" -> "AB.AC" [color=red, taillabel="I(A;B)"]
"AC.BC" -> "AB.AC.BC"
"AC.BC" -> "ABC" [color=red,style=dashed, label="I(A;B|C)"]
"AB.AC" -> "AB.AC.BC"
"AB.AC" -> "ABC" [color=red,style=dashed, label="I(B;C|A)"]
"AB.C" -> "AB.BC" [color=red, taillabel="I(A;B)"]
"AB.C" -> "AB.AC" [color=red, taillabel="I(A;C)"]
}
I'm tying to draw the IDEF0 diagram example using Graphviz
digraph UDEF0 {
"Plan New Information Program" [shape=box]
"Issues" [shape=none]
"Operation Data" [shape=none]
"Program Charter" [shape=none]
"Program Team" [shape=none]
"Program Plan" [shape=none]
"Issues" -> "Plan New Information Program"
"Operation Data" -> "Plan New Information Program"
"Program Charter" -> "Plan New Information Program"
"Program Team" -> "Plan New Information Program"
"Plan New Information Program" -> "Program Plan"
}
The problem is that I can't find the way to control direction of arrows around the central box.
I've tried to use hidden "frame" made of invisible South, North, East and West nodes to connect arrows to them. Unfortunately the "frame" works well only if it is empty, and when I connect my "payload" nodes to it, the structure breaks:
digraph UDEF0 {
rankdir=LR
"Plan New Information Program" [shape=box]
"Issues" [shape=none]
"Operation Data" [shape=none]
"Program Charter" [shape=none]
"Program Team" [shape=none]
"Program Plan" [shape=none]
"Program Plan" [shape=none]
"West" [shape=none]
"North" [shape=none]
"South" [shape=none]
"East" [shape=none]
"West" -> "North" -> "East"
"West" -> "South" -> "East"
"West" -> "Issues" -> "Plan New Information Program"
"West" -> "Operation Data" -> "Plan New Information Program"
"North" -> "Program Charter" -> "Plan New Information Program"
"South" -> "Program Team" -> "Plan New Information Program"
"East" -> "Plan New Information Program" -> "Program Plan"
}
Is the any correct way to implement this diagram style?
Using shape = record brings you close to what you want - here my re-written attempt:
digraph UDEF0
{
A[ label = "Plan New\nInformation\nProgram", shape=box, style = filled, fillcolor = grey ]
B[ shape = record, color = white, label = "{ Operation Data | Issues }" ]
node[ shape = none ]
c[ label = "Program Charter" ]
d[ label = "Program Team" ]
e[ label = "Program Plan" ]
{ rank = same; A B e }
c -> A;
A -> d[ dir = back ];
edge[ minlen = 3]
B -> A;
B -> A;
A -> e;
}
yields
E D I T 2018-11-29
In order to avoid the issues that #McKay has shown in his comment, I have re-coded the sample using a HTML like label:
digraph UDEF0
{
A[ label = "Plan New\nInformation\nProgram", shape=box, style = filled, fillcolor = grey ]
B[ shape = plaintext, label =<
<TABLE BORDER="0" CELLBORDER="0" CELLSPACING="15">
<TR>
<TD PORT = "p1">Issues</TD>
</TR>
<TR>
<TD PORT = "p2">Operation Data</TD>
</TR>
</TABLE>>];
node[ shape = none ]
c[ label = "Program Charter" ]
d[ label = "Program Team" ]
e[ label = "Program Plan" ]
{ rank = same; A B e }
c -> A;
A -> d[ dir = back ];
edge[ minlen = 3]
B:p1 -> A;
B:p2 -> A;
A -> e;
}
Which gives us
without warning or error message on my Linux box with graphviz version 2.38.0 (20140413.2041).
I'm generating a graph with graphviz and the circo tool it provides.
The graph generated is a nice shape, but the lengths of the edges between the nodes are a lot larger than they need to be, which makes the text of the nodes be small (relative to the output image) and so hard to read.
How can I make the node be bigger (relatively) in the output image, so that the text inside the nodes is easier to read,
Output image:
Source graph file:
digraph G {
FoundUrlToFollow [shape=box];
"Fetch the URL" [shape=circle];
FoundUrlToFollow -> "Fetch the URL";
ResponseReceived [shape=box];
"Fetch the URL" [shape=circle, label=<Fetch the URL>];
"Fetch the URL" -> ResponseReceived;
ResponseError [shape=box];
"Fetch the URL" [shape=circle, label=<Fetch the URL>];
"Fetch the URL" -> ResponseError;
ResponseReceived [shape=box];
"Log response" [shape=circle];
ResponseReceived -> "Log response";
ResponseReceived [shape=box];
"Is the response OK?" [shape=circle];
ResponseReceived -> "Is the response OK?";
ResponseOk [shape=box];
"Is the response OK?" [shape=circle, label=<Is the response<br/>OK?>];
"Is the response OK?" -> ResponseOk;
ResponseOk [shape=box];
"Is the response HTML?" [shape=circle];
ResponseOk -> "Is the response HTML?";
HtmlToParse [shape=box];
"Is the response HTML?" [shape=circle, label=<Is the response<br/>HTML?>];
"Is the response HTML?" -> HtmlToParse;
HtmlToParse [shape=box];
"Parse the HTML to find links" [shape=circle];
HtmlToParse -> "Parse the HTML to find links";
FoundUrl [shape=box];
"Parse the HTML to find links" [shape=circle, label=<Parse the HTML<br/>to find links>];
"Parse the HTML to find links" -> FoundUrl;
FoundUrl [shape=box];
"Should we follow this URL?" [shape=circle];
FoundUrl -> "Should we follow this URL?";
FoundUrlToSkip [shape=box];
"Should we follow this URL?" [shape=circle, label=<Should we<br/>follow this<br/>URL?>];
"Should we follow this URL?" -> FoundUrlToSkip;
FoundUrlToFollow [shape=box];
"Should we follow this URL?" [shape=circle, label=<Should we<br/>follow this<br/>URL?>];
"Should we follow this URL?" -> FoundUrlToFollow;
FoundUrlToSkip [shape=box];
"Log skipped links" [shape=circle];
FoundUrlToSkip -> "Log skipped links";
graph [label="Switches are circles. Events are boxes.", fontsize="12", overlap=scale];
edge [splines=curved];
}
Command:
circo -Tpng -ograph_so.png graph.dot
I would try to add mindist (less than 1) to graph:
graph [..., overlap=scale, mindist=.6];
[edit]
maybe the renderer version make a difference: here is the outcome on my machine
Try varying -Gsize (units of inches) and -Gdpi. You'll find that if you change them both together, you get different outputs with the same pixel size, but with different spacing between the nodes relative to the size of the nodes themselves. -Gnodesep and -Nfontsize might also be useful to tweak. You might also have better luck by rendering to EPS or PDF or SVG and then converting that to PNG, instead of using Graphviz's PNG renderer. Getting pleasing output from Graphviz is, in my experience, a very inexact science.
I want to improve compiling speed of my latex thesis. I have read that using \tikzexternalize, only when there is a change in the tikz codes they are compiled.
The problem is that I can no use \tikzexternalize properly. This is my preamble:
\usepackage{circuitikz}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows, shadows, calc,positioning}
\tikzexternalize
And this is not working at all. I received next error:
Undefined control sequence. \tikzexternalize
If it is useful, I am using MikTex with TextStudio and TextLive with Textstudio also under Ubuntu. It doesn't work in any of these system.
Hope you can help me.
Didn't you forget to add
\usetikzlibrary{external}
? I just found it here : tex.stackexchange
I have done it.
Now I don't have any error messages, but no figures are saved into TikzFigures folder. This is my preamble:
\usepackage{circuitikz}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows, shadows, calc,positioning,external}
\tikzexternalize[mode=graphics if exists,
figure list=true,
prefix=TikzFigures/]
This is how I add my tikz figures. First example is by using circuitikz.
\begin{figure}[h]
\centering
\tikzsetnextfilename{nonInverter}
\begin{circuitikz}[scale=1]\draw
(4,.5) node [op amp](opamp) {} % Amplificador Operacional
(0,0) node [ ground]{} to (0,1)
to [R=$Sensor A201$,-*] (opamp.-)
(opamp.out)|- (5,2.5) to [R=$R_{F}$](2.8,2.5) to (opamp.-)
(opamp.+) to [short,-o] (2.8,-1) node [right] {$V_{+}$}
(opamp.out) to [short, *-o] (6,.5) node[right] {$V_{ADC}$}
;\end{circuitikz}
\end{figure}
Next one, is by using the common tikz package:
\begin{figure}[h]
\begin{center}
\tikzsetnextfilename{masterFlowChart}
\begin{tikzpicture}[node distance = 2cm, auto]
% Colocamos los nodos
\node [cloud] (init) {Initialize System};
\node [block, below of=init] (connection) {Connection to the master};
\node [block, below of=connection] (wait) {Wait for master events};
\node [block, below of=wait] (measure) {Measure and send to master};
% invisible node helpful later
\node[right of=wait,scale=0.05](inv){};
% Colocamos las relaciones entre nodos
\path [line] (init) -- (connection);
\path [line] (connection) edge[loop left] node {No Network}();
\path [line] (connection) -- (wait);
\path[-,draw] (wait) -| node{} (inv.north);
\path[line]{} (inv.north) |- node[above]{Reconnect} (connection);
\path [line] (wait) edge[loop left] node {Sleep}();
\path [line] (wait) -- (measure);
\path [line] (measure) -- (wait);
\end{tikzpicture}
\end{center}
\label{fig:slave_flowchart}
\end{figure}
And last one is by using sequencediagram package, that if I am not wrong is also based on tikz.
\begin{figure}[h]
\begin{center}
\tikzsetnextfilename{sequenceDiagramaECnsole10}
\begin{sequencediagram}
\newthread{pc}{PC}
\newinst[2]{master}{Master}
\newinst[2]{slave}{Slave}{}
\node[below right of=master,font=\scriptsize](master_state){Idle};
\node[below right of=slave,font=\scriptsize](slave_state){Sleep};
\begin{sdblock}{Run Loop}{}
\begin{call}{pc}{Start Measurement}{master}{Master Data}
\begin{call}{master}{Data Request}{slave}{Slave Data}
\end{call}
\end{call}
\end{sdblock}
\node[below of=master_state,font=\scriptsize, node distance= 4cm]{Idle};
\node[below of=slave_state,font=\scriptsize, node distance= 4cm]{Sleep};
\end{sequencediagram}
\end{center}
\label{fig:ecnsole_sequence_diagram}
\end{figure}