hackl / tikz-network Goto Github PK
View Code? Open in Web Editor NEWA tool to visualize complex networks in LaTeX
License: GNU General Public License v3.0
A tool to visualize complex networks in LaTeX
License: GNU General Public License v3.0
This is not really a bug, but a request (and suggestion).
I have been using
\SetCoordinates[options]
\begin {scope} [multilayer = 3d]
...
\end{scope}
or
...
\Plane[options, style={rotate=angle}]
...
To try to rotate both the layer and the plane (individually), and in the first code I can do it but in the second code just rotates the plane and not the layer.
But although I can rotate the layer (individually) and plane (individually) using scope, when I try to change the distance between two edge bound vertices I get the message "Dimension too large".
Hello!
Thanks for putting this great work together!
I would have one feature request in order to make your package suitable for my needs: I'm trying to draw a network where interactions are directed and can be either positive or negative which I would like to be able show graphically (showing positive interaction with a arrow head, and negative one with a dash, see here for example). Would it be possible to add this feature?
Thanks!
I tried to omit the use of RGB in vertices.csv and edges.csv and I don't know if the label "C" was not shown to be related to this omission.
My MWE following first page example 27 from manual tikz-network.
\documentclass{article}
\usepackage{tikz-network}
\thispagestyle{empty}
\begin{document}
\begin{tikzpicture}
\Vertices{data/vertices.csv}
\Edges{data/edges.csv}
\end{tikzpicture}
\end{document}
My new settings in edges.csv omitting RGB settings
u,v,label,lw,color ,opacity,bend
A,B, ab ,.5,red , 1 , 30
B,C, bc ,.7,blue , 1 , -60
B,D, bd ,.5,blue , .5 , -60
A,E, ae , 1,green , 1 , 75
C,E, ce , 2,orange, 1 , 0
A,A, aa ,.3,black , .5 , 75
My new settings in vertices.csv omitting RGB settings
id, x, y ,size, color,opacity,label,IdAsLabel,NoLabel
A, 0, 0, .4 , green, .9 , a , false , false
B, 1, .7, .6 , , .5 , b , false , false
C, 2, 1, .8 ,orange, .3 , c , false , true
D, 2, 0, .5 , red, .7 , d , true , false
E,.2,1.5, .5 , gray, , e , false , false
When using several \Vertices commands in the same document wrong input files are used.
MWE:
\documentclass{article}
\usepackage{tikz-network}
\begin{document}
\begin{tikzpicture}
\Vertices{cci14.txt}
\end{tikzpicture}
\begin{tikzpicture}
\Vertices{cci23.txt}
\end{tikzpicture}
\begin{tikzpicture}
\Vertices{cci14.txt}
\end{tikzpicture}
\begin{tikzpicture}
\Vertices{cci23.txt}
\end{tikzpicture}
\end{document}
This yields different output for the first and third input, which are identical.
Not a bug but rather the wish for an additional feature.
I'd like to be able to insert arbitrary text between \begin{tikzpicture}
and the first \Vertex
-Statement. In particular this would allow me to insert lines such as the following:
\SetDistanceScale{1.2} \SetVertexStyle[FillColor=blue,FillOpacity=0.7,LineOpacity=0.7,MinSize=0.5cm]
as well as comments for myself.
Especially when using a lot of options, the resulting .tex-file becomes much more readable by not repeating global options within every vertex or edge statement. It would also allow to use features for nodes, which are not implemented in tikz-network such as LineOpacity for the borders of nodes.
Giving tikz-network ( c21bb81 ) a try, all the examples in the manual to be plagued with this bug
I suspect some default code useful for label alignment ends up intepreted prepended to the label (escaping, missing parens or whatever reason)
Hello! I am trying to set the outer color and fill color of a vertex separately - for example, setting the outline to light grey and the fill color to light blue to de-emphasize some vertices in an illustration.
The color
Vertex attribute controls the fill color, but not the outline color, which remains black. Instead, it looks like I need to set the tikz style, like:
\Vertex[style={color=black!20,fill=blue!20}]{A}
This works for an individual vertex, but I cannot figure out how to add the same rules to a CSV. I've tried a few variations on:
id, x, y, label, style
v0, 0.238, 3.926, v0, black!20,fill=blue!20
Presumably this doesn't work because we can't have a comma in the CSV value. Escaping the comma, either with backslashes, {black!20,fill=blue!20}
, or "{black!20,fill=blue!20}"
, has not worked. Breaking the single style
field into two style fields hasn't worked, either. I've tried using space-separated .dat files instead of CSV, but have been unable to get \Vertices
to read them.
Is there a way to accomplish what I'm trying to do? Or, ideally, would it be possible to add some kind of outlineColor
attribute to tikz-network vertices to make this process much simpler? Thanks!
As pointed out at https://tex.stackexchange.com/questions/502182/shape-c-not-found-in-the-files-csv-tikz-network-package I ask your opinion @hackl and the suggestion for use of standalone in the manual examples in order to circumvent potential problems by users by compiling the same examples individually on their own. Thank you for writing this package which helps a lot to deal with and visualize the dynamics behind processes, especially with integrated information theory.
Could you please provide an example how to import figures as background images in the layers of a multilayer network, as used in the front page example network? Also, how do you create the labels next to the layers?
If you just give the source code how to create the front image, that would be very helpful to see the necessary commands.
When I create nodes with the \node command I can change the label colour, e.g. with
\node at (0,0)[font=\footnotesize,orange]{\textbf{A}};
Is there any way to achieve this when I import node information from a .csv file through the \Vertices command?
Suggestion:
I have no idea what the cause is and also what the solution would be but I ask that when using multilayer = 3d I the text provided by the "label" option can be searchable. Because only when drawing using multilayer = 3d I can't make the vertex label searchable.
From the section "B.1.4 Simple example" extracted from the tikz-network manual according to the code below, the search works normally:
\documentclass{standalone}
\usepackage{tikz-network}
\begin{document}
\begin{tikzpicture}
\clip (0,0) rectangle (8.0,8.0);
\Vertex[x=2.868,y=5.518,size=0.5,color=red,opacity=0.7,label=Alice,position=below]{a}
\Vertex[x=1.000,y=7.000,size=0.5,color=blue,opacity=0.7,label=Bob,position=below]{b}
\Vertex[x=5.006,y=5.387,size=0.5,color=red,opacity=0.7,label=Claire,position=below]{c}
\Vertex[x=6.858,y=3.552,size=0.5,color=blue,opacity=0.7,label=Dennis,position=below]{d}
\Vertex[x=7.000,y=6.419,size=0.5,color=red,opacity=0.7,label=Esther,position=below]{e}
\Vertex[x=3.698,y=2.808,size=0.5,color=blue,opacity=0.7,label=Frank,position=below]{f}
\Vertex[x=5.551,y=1.000,size=0.5,color=blue,opacity=0.7,label=George,position=below]{g}
\Edge[,lw=1.0,bend=-8.531,Direct](a)(b)
\Edge[,lw=1.0,bend=-8.531,Direct](a)(c)
\Edge[,lw=3.0,bend=-8.531,Direct](c)(d)
\Edge[,lw=3.0,bend=-8.531,Direct](d)(e)
\Edge[,lw=3.0,bend=-8.531,Direct](e)(c)
\Edge[,lw=1.0,bend=-8.531,Direct](c)(f)
\Edge[,lw=3.0,bend=-8.531,Direct](f)(a)
\Edge[,lw=1.0,bend=-8.531,Direct](f)(g)
\Edge[,lw=1.0,bend=-8.531,Direct](g)(g)
\Edge[,lw=1.0,bend=-8.531,Direct](g)(d)
\end{tikzpicture}
\end{document}
Add options to change the size of the arrowhead as already implemented in network2tikz, e.g. see edge_arrow_size
and edge_arrow_width
.
When using a path=
in edge specifications, issues occur in styling the arrow head, both using style=
or Direct
. MWE and screenshot below.
Perhaps this can be noted in the documentation.
\documentclass{standalone}
\usepackage{tikz-network}
\begin{document}
\begin{tikzpicture}
\Vertex[x=-2, y=1]{z1}
\Vertex[x=-1, y=0]{z2}
\Edge[style={-{latex}}, path={z1, {1, 1}, z2}](z1)(z2)
\end{tikzpicture}
\begin{tikzpicture}
\Vertex[x=-2, y=1]{z1}
\Vertex[x=-1, y=0]{z2}
\Edge[Direct, path={z1, {1, 1}, z2}](z1)(z2)
\end{tikzpicture}
\end{document}
I am doing some modeling works, and would like to organize a set of edges into "chunks". As the *.csv
format is super helpful when combined with Excel as a Viewer/Editor, I think it is a legitimate usage to leave one line blank in the edge list. This shall denote the start/end of a set of relevant edges. (Of course, I may as well use more labels to denote such set of edges.)
Currently, an empty line in the edge_list.csv
file is rendered as a self-loop for the first node.
Lastly, a Thank You Note!
I have been stuck with plotting networks in tikz
for years, and have found this repo in particular helpful: it helps with integrating the plotting task with the modeling practices ==> the edge-list and node-list are now ready for use at more than one occasions! This saves a lot of effort in converting the format, and helps a lot for documentation purpose!
Writing the code with no spaces between the arguments of "\Edge[h local options i](Vertex i)(Vertex j)
" normally handles processing:
\documentclass{article}
\usepackage {tikz-network}
\thispagestyle {empty}
\begin {document}
\begin {tikzpicture}
\Vertex{A} \Vertex [x = 2] {B} \Vertex [x = 2, y = -1] {C}
\Edge [lw = 3pt] (A) (B)
\Edge [lw = 5pt] (A) (C)
\end {tikzpicture}
\end {document}
But if there is spacing (whatever that is) between the arguments of "\Edge[h local options i](Vertex i)
" as shown below:
\documentclass{article}
\usepackage{tikz-network}
\thispagestyle {empty}
\begin {document}
\begin {tikzpicture}
\Vertex {A} \Vertex [x = 2] {B} \Vertex [x = 2, y = -1] {C}
% Case 1: space between <[lw = 3pt]> and <(A)(B)>
\Edge [lw = 3pt] (A)(B)
% Case 2 (below): or even if there is a space between <(A)> and <(C)> as below
\Edge[lw = 5pt](A) (C)
\end {tikzpicture}
\end {document}
I get the following errors in their order as is the spacing in the code above:
Case 1 - Space between <[lw = 3pt]
> and <(A)(B)
> returns the following error:
Runaway argument?
(A)(B) \ end {tikzpicture} \ end {document}
! File ended while scanning use of \ @edge.
<inserted text>
\pair
<*> 17.tex
?
Case 2 - Space between <[lw = 5pt] (A)
> and <(C)
> returns the following error:
! Undefined control sequence.
\ pgfonlayer @ assert @ is @ active ... fonlayer @ isactive
{0} \ expandfter \ pgf @ asser ...
1.8 \ Edge [lw = 5pt] (A) (C)
?
Note 1: Putting spacing between <\Edge> and <[h local options i](Vertex i)(Vertex j)
> returns no error.
Note 2: Examples taken from Section 2.2
, page 15 of https://ctan.org/pkg/tikz-network.
Note 3: Command latexmk and Zathura viewer were used.
Apparently everything is related to using the lw
(\Edge
line width size) option.
Note 4: As advised at https://tex.stackexchange.com/a/501300/178949 by user TeXnician there is apparently a guideline in the code script preventing the inclusion of spacing.
Is it possible to create a color bar, that tells the range of line width values? Similarly, it would be nice to have an option that outputs colorbar based on the intensity of colors. These will be important features for creating network-based heatmaps.
\begin{tikzpicture}
\Vertices{data/vertices.csv}
\Edges[Direct]{data/edges.csv}
\end{tikzpicture}
As per example on page 26 of the manual (https://github.com/hackl/tikz-network/) when doing latexmk -pdflua -pvc or latexmk -pdfxe -pvc I get the following error below. Note: already tried #5:
! Package xkeyval Error: `R' undefined in families `vertex'.
See the xkeyval package documentation for explanation.
Type H <return> for immediate help.
...
l.6 \Vertices[RGB]{data/vertices_RGB.csv}
?
MWE:
\documentclass{article}
\usepackage{tikz-network}
\thispagestyle{empty}
\begin{document}
\begin{tikzpicture}
\Vertices[RGB]{data/vertices_RGB.csv}
\end{tikzpicture}
\end{document}
Greetings :)
I got the following graph:
\documentclass{standalone}
\usepackage{tikz}
\usepackage{tikz-network}
\begin{document}
\begin{tikzpicture}
\clip (0,0) rectangle (30.0,30.0);
\Vertex[x=29.000,y=15.000,size=2.0,color={0,77,153},opacity=0.7,label=A0,fontcolor={230,230,230},fontscale=2.286,RGB]{A0}
\Vertex[x=22.000,y=27.124,size=2.0,color={0,77,153},opacity=0.7,label=A4,fontcolor={230,230,230},fontscale=2.286,RGB]{A4}
\Vertex[x=8.000,y=27.124,size=2.0,color={0,77,153},opacity=0.7,label=A3,fontcolor={230,230,230},fontscale=2.286,RGB]{A3}
\Vertex[x=1.000,y=15.000,size=2.0,color={0,77,153},opacity=0.7,label=A1,fontcolor={230,230,230},fontscale=2.286,RGB]{A1}
\Vertex[x=8.000,y=2.876,size=2.0,color={0,77,153},opacity=0.7,label=A5,fontcolor={230,230,230},fontscale=2.286,RGB]{A5}
\Vertex[x=22.000,y=2.876,size=2.0,color={0,77,153},opacity=0.7,label=A2,fontcolor={230,230,230},fontscale=2.286,RGB]{A2}
\Edge[,lw=3.6871,color=purple,opacity=0.4687143150544264,bend=-8.531,label=11968.5/32460.0: 0.37,Direct](A0)(A4)
\Edge[,lw=3.2066,color=purple,opacity=0.4206628671185051,bend=-8.531,label=10408.7/32460.0: 0.32,Direct](A0)(A3)
\Edge[,lw=6.0346,color=purple,opacity=0.7034586157321837,bend=-8.531,label=19588.3/32460.0: 0.60,Direct](A0)(A1)
\Edge[,lw=1.2568,color=purple,opacity=0.22568186485931396,bend=-8.531,label=4079.6/32460.0: 0.13,Direct](A0)(A5)
\Edge[,lw=1.5525,color=purple,opacity=0.25524799753542815,bend=-8.531,label=5039.3/32460.0: 0.16,Direct](A0)(A2)
\Edge[,lw=2.9291,color=purple,opacity=0.39291401533692316,bend=-8.531,label=11968.5/40860.0: 0.29,Direct](A4)(A0)
\Edge[,lw=3.6119,color=purple,opacity=0.4611890194158921,bend=-8.531,label=14758.2/40860.0: 0.36,Direct](A4)(A3)
\Edge[,lw=6.6366,color=purple,opacity=0.763656387665199,bend=-8.531,label=27117.0/40860.0: 0.66,Direct](A4)(A1)
\Edge[,lw=1.9087,color=purple,opacity=0.29087045194974714,bend=-8.531,label=7799.0/40860.0: 0.19,Direct](A4)(A2)
\Edge[,lw=3.4455,color=purple,opacity=0.44454540439148216,bend=-8.531,label=10408.7/30210.0: 0.34,Direct](A3)(A0)
\Edge[,lw=4.8852,color=purple,opacity=0.5885198058038182,bend=-8.531,label=14758.2/30210.0: 0.49,Direct](A3)(A4)
\Edge[,lw=7.1194,color=purple,opacity=0.8119392033542985,bend=-8.531,label=21507.7/30210.0: 0.71,Direct](A3)(A1)
\Edge[,lw=1.132,color=purple,opacity=0.21319651329581812,bend=-8.531,label=3419.7/30210.0: 0.11,Direct](A3)(A5)
\Edge[,lw=2.522,color=purple,opacity=0.3522029129427343,bend=-8.531,label=7619.1/30210.0: 0.25,Direct](A3)(A2)
\Edge[,lw=2.9965,color=purple,opacity=0.3996522359900059,bend=-8.531,label=19588.3/65370.0: 0.30,Direct](A1)(A0)
\Edge[,lw=4.1482,color=purple,opacity=0.5148233134465356,bend=-8.531,label=27117.0/65370.0: 0.41,Direct](A1)(A4)
\Edge[,lw=3.2901,color=purple,opacity=0.4290145836520324,bend=-8.531,label=21507.7/65370.0: 0.33,Direct](A1)(A3)
\Edge[,lw=1.9365,color=purple,opacity=0.29364514813115106,bend=-8.531,label=12658.6/65370.0: 0.19,Direct](A1)(A2)
\Edge[,lw=4.945,color=purple,opacity=0.5945010101010099,bend=-8.531,label=4079.6/8250.0: 0.49,Direct](A5)(A0)
\Edge[,lw=4.145,color=purple,opacity=0.5145010101010101,bend=-8.531,label=3419.6/8250.0: 0.41,Direct](A5)(A4)
\Edge[,lw=4.1451,color=purple,opacity=0.5145050505050504,bend=-8.531,label=3419.7/8250.0: 0.41,Direct](A5)(A3)
\Edge[,lw=6.6902,color=purple,opacity=0.7690242424242423,bend=-8.531,label=5519.4/8250.0: 0.67,Direct](A5)(A1)
\Edge[,lw=2.7269,color=purple,opacity=0.3726929292929293,bend=-8.531,label=2249.7/8250.0: 0.27,Direct](A5)(A2)
\Edge[,lw=2.3138,color=purple,opacity=0.33137511478420556,bend=-8.531,label=5039.3/21780.0: 0.23,Direct](A2)(A0)
\Edge[,lw=3.5808,color=purple,opacity=0.45807927762473233,bend=-8.531,label=7799.0/21780.0: 0.36,Direct](A2)(A4)
\Edge[,lw=3.4982,color=purple,opacity=0.4498186409550048,bend=-8.531,label=7619.1/21780.0: 0.35,Direct](A2)(A3)
\Edge[,lw=5.812,color=purple,opacity=0.6812021732476283,bend=-8.531,label=12658.6/21780.0: 0.58,Direct](A2)(A1)
\Edge[,lw=1.0329,color=purple,opacity=0.20329277624732173,bend=-8.531,label=2249.7/21780.0: 0.10,Direct](A2)(A5)
\end{tikzpicture}
\end{document}
PDF: test2.pdf
How can I achieve that the edge labels are (1) always along the edges and (2) manipulate the size of the white circle around the edge labels?
Similar to this graph: text.pdf
Currently, the RGB option has to be enabled in the latex document by using:
\Edges[RGB]{edges.csv}
The library should be able to detect the RGB values directly from the csv file.
Add the fontscale option also to text objects:
\Text[fontscale=0.75]{Text}
Here is my code:
\usepackage{tikz-network}
\usepackage{tikz-qtree}
\begin{document}
\begin{tikzpicture}[sibling distance=0.6em]
\Tree [.A [.B ] \edge[draw=none]; {} ]
\Vertex[label=A]{A}
\Vertex[label=B,x=1]{B}
\Edge[label=6](A)(B)
\end{tikzpicture}
\end{document}
A error occured when I compiled it with xelatex.
Here is a part of output:
e:/.../mwe.tex:10: Use of \@edge doesn't match its definition.
\\Edge [#1]->\@edge [
#1]
l.10 \Edge[label=6]
(A)(B)
?
Add a command to define globally the fontscale
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.