texlive[51884] Master: tikz-network (15aug19)
commits+karl at tug.org
commits+karl at tug.org
Thu Aug 15 22:22:27 CEST 2019
Revision: 51884
http://tug.org/svn/texlive?view=revision&revision=51884
Author: karl
Date: 2019-08-15 22:22:22 +0200 (Thu, 15 Aug 2019)
Log Message:
-----------
tikz-network (15aug19)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/tikz-network/README.md
trunk/Master/texmf-dist/doc/latex/tikz-network/tikz-network.pdf
trunk/Master/texmf-dist/doc/latex/tikz-network/tikz-network.tex
trunk/Master/texmf-dist/tex/latex/tikz-network/tikz-network.sty
trunk/Master/tlpkg/libexec/ctan2tds
Modified: trunk/Master/texmf-dist/doc/latex/tikz-network/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/tikz-network/README.md 2019-08-14 23:47:24 UTC (rev 51883)
+++ trunk/Master/texmf-dist/doc/latex/tikz-network/README.md 2019-08-15 20:22:22 UTC (rev 51884)
@@ -56,7 +56,7 @@
## License
-Copyright (c) 2018 [Juergen Hackl](mailto:hackl.j at gmx.at)
+Copyright (c) 2019 [Juergen Hackl](mailto:hackl.j at gmx.at)
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Modified: trunk/Master/texmf-dist/doc/latex/tikz-network/tikz-network.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/tikz-network/tikz-network.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/tikz-network/tikz-network.tex 2019-08-14 23:47:24 UTC (rev 51883)
+++ trunk/Master/texmf-dist/doc/latex/tikz-network/tikz-network.tex 2019-08-15 20:22:22 UTC (rev 51884)
@@ -2,10 +2,10 @@
% File : tikz-network.tex -- The manual for the package tikz-network
% Author : Juergen Hackl <hackl.j at gmx.at>
% Creation : 2018-07-30
-% Time-stamp: <Mon 2018-07-30 11:28 juergen>
+% Time-stamp: <Thu 2019-08-15 11:22 juergen>
+%e
+% Copyright (c) 2019 Juergen Hackl <hackl.j at gmx.at>
%
-% Copyright (c) 2018 Juergen Hackl <hackl.j at gmx.at>
-%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
@@ -28,7 +28,7 @@
% Book metadata
\title{tikz-network\\manual}
\author[J\"urgen Hackl]{J\"urgen Hackl}
-\publisher{Version 1.0}
+\publisher{Version 1.1}
%%
% If they're installed, use Bergamo and Chantilly from www.fontsite.com.
@@ -83,6 +83,10 @@
\usepackage{xspace}
%%
+% needed for its \numberwithin command
+\usepackage{amsmath}
+
+%%
% Some shortcuts for Tufte's book titles. The lowercase commands will
% produce the initials of the book title in italics. The all-caps commands
% will print out the full title of the book in italics.
@@ -173,9 +177,20 @@
\newcommand{\docfilehook}[2]{\texttt{#1}\index{file hooks!#2}\index{#1@\texttt{#1}}}
\newcommand{\doccounter}[1]{\texttt{#1}\index{#1 counter@\texttt{#1} counter}}
+%%
+% Example environment
-\newenvironment{docspec}{\begin{shaded}}{\vspace{-5mm}\end{shaded}}% command specification environment
+% Create counter
+\newcounter{doccount}
+\newenvironment{docspec}{%
+ \bigskip\noindent% create a vertical offset to previous material
+ \refstepcounter{doccount}% increment the environment's counter
+ \llap{\parbox{1.5cm}{\hfill\small\thedoccount}\hspace{2mm}}\vspace{-9mm}
+ \begin{shaded}
+ }
+ {\vspace{-5mm}\end{shaded}}% command specification environment
+\numberwithin{doccount}{chapter}
% Numerate the sections
\setcounter{secnumdepth}{2}
@@ -182,7 +197,11 @@
\setcounter{tocdepth}{3}
+\newenvironment{docspeca}{\begin{shaded}}
+ {\vspace{-5mm}\end{shaded}}% command specification environment
+
+
\usepackage{etoolbox}
\makeatletter
@@ -1103,7 +1122,7 @@
The font size of the \docopt{label} can be modified with the option \docopt{fontsize}. Here common \LaTeX~ font size commands\footnote{e.g. \doccmd{tiny}, \doccmd{scriptsize}, \doccmd{footnotesize}, \doccmd{small}, \dots.} can be used to change the size of the label.
-\begin{marginfigure}[6mm]
+\begin{marginfigure}[25mm]
\centering
\begin{tikzpicture}
\Vertex{A} \Vertex[x=2]{B} \Vertex[x=2,y=-1]{C}
@@ -1440,7 +1459,9 @@
In order to display RGB colors for the line color of the edge, the option \docopt{RGB} has to be entered. In combination with this option, the \docopt{color} hast to be a list with the \docarg{RGB
values}, separated by <<,>> and within $\{~\}$.\footnote{e.g. the RGB code for white: $\{255,255,255\}$}
-\begin{marginfigure}%[28mm]
+\newpage
+
+\begin{marginfigure}[10mm]
\centering
\begin{tikzpicture}
\Vertex{A} \Vertex[x=2]{B} \Vertex[x=2,y=-1]{C}
@@ -1976,7 +1997,7 @@
\centering
\begin{tikzpicture}
\Vertices[IdAsLabel]{data/vertices.csv}
- \node at (2,1)[font=\scriptsize]{C};
+ %\node at (2,1)[font=\scriptsize]{C};
\end{tikzpicture}
\end{marginfigure}
@@ -3198,7 +3219,7 @@
\end{tikzpicture}
\end{marginfigure}
-\begin{docspec}
+\begin{docspeca}
\begin{lstlisting}
#!/usr/bin/python -tt
# -*- coding: utf-8 -*-
@@ -3217,11 +3238,11 @@
from network2tikz import plot
plot((nodes,edges),'network.tex',**style)
\end{lstlisting}
-\end{docspec}
+\end{docspeca}
(see above) gives
-\begin{docspec}
+\begin{docspeca}
\begin{lstlisting}
\documentclass{standalone}
\usepackage{tikz-network}
@@ -3239,7 +3260,7 @@
\end{tikzpicture}
\end{document}
\end{lstlisting}
-\end{docspec}
+\end{docspeca}
Tweaking the plot is straightforward and can be done as part of your LaTeX workflow.
@@ -3248,11 +3269,11 @@
\texttt{network2tikz} is available from the \href{https://pypi.org/project/network2tikz/}{Python Package Index}, so simply type
-\begin{docspec}
+\begin{docspeca}
\begin{lstlisting}
pip install -U network2tikz
\end{lstlisting}
-\end{docspec}
+\end{docspeca}
to install/update. If your are intersted in the development version of the module check out the \href{https://github.com/hackl/network2tikz}{github repository}.
@@ -3262,48 +3283,57 @@
\item Generate, manipulation, and study of the structure, dynamics, and functions of your complex networks as usual, with your preferred python module.
\item Instead of the default plot functions (e.g. \texttt{igraph.plot()} or \texttt{networkx.draw()}) invoke \texttt{network2tikz} by
-\begin{docspec}
+
+\begin{docspeca}
\begin{lstlisting}
plot(G,'mytikz.tex')
\end{lstlisting}
-\end{docspec}
+\end{docspeca}
+
to store your network visualisation as the TikZ file \texttt{mytikz.tex}. Load the module with:
-\begin{docspec}
+
+\begin{docspeca}
\begin{lstlisting}
from network2tikz import plot
\end{lstlisting}
-\end{docspec}
+\end{docspeca}
\textbf{Advanced usage:}
Of course, you always can improve your plot by manipulating the generated LaTeX file, but why not do it directly in Python? To do so, all visualization options available in \pkg are also implemented in \texttt{network2tikz}. The appearance of the plot can be modified by keyword arguments.\footnote{For a detailed explanation, please see Section \ref{sec:plot_function}.}
-\begin{docspec}
+
+\begin{docspeca}
\begin{lstlisting}
my_style = {}
plot(G,'mytikz.tex',**my_style)
\end{lstlisting}
-\end{docspec}
+\end{docspeca}
The arguments follow the options described above in the manual.
Additionally, if you are more interested in the final output and not only the \texttt{.tex} file, used
-\begin{docspec}
+
+\begin{docspeca}
\begin{lstlisting}
plot(G,'mypdf.pdf')
\end{lstlisting}
-\end{docspec}
+\end{docspeca}
+
to save your plot as a pdf, or
-\begin{docspec}
+
+\begin{docspeca}
\begin{lstlisting}
plot(G)
\end{lstlisting}
-\end{docspec}
+\end{docspeca}
+
to create a temporal plot and directly show the result, i.e. similar to the matplotlib function \texttt{show()}. Finally, you can also create a node and edge list, which can be read and easily modified (in a post-processing step) as showd above.
-\begin{docspec}
+
+\begin{docspeca}
\begin{lstlisting}
plot(G,'mycsv.csv')
\end{lstlisting}
-\end{docspec}
+\end{docspeca}
\item Compile the figure or add the contents of \texttt{mytikz.tex} into your LaTeX source code. With the option \docopt{standalone}=\docarg{false} only the \tikzsym figure will be saved, which can then be easily included in your \LaTeX~ document via \doccmd{input}\{\texttt{/path/to/mytikz.tex}\}.
@@ -3315,7 +3345,8 @@
Create network object and add some edges.
-\begin{docspec}
+
+\begin{docspeca}
\begin{lstlisting}
#!/usr/bin/python -tt
# -*- coding: utf-8 -*-
@@ -3326,11 +3357,11 @@
net = igraph.Graph([(0,1), (0,2), (2,3), (3,4), (4,2), (2,5), (5,0), (6,3),
(5,6), (6,6)],directed=True)
\end{lstlisting}
-\end{docspec}
+\end{docspeca}
Adding node and edge properties.
-\begin{docspec}
+\begin{docspeca}
\begin{lstlisting}
net.vs["name"] = ["Alice", "Bob", "Claire", "Dennis", "Esther", "Frank", "George"]
net.vs["age"] = [25, 31, 18, 47, 22, 23, 50]
@@ -3338,7 +3369,7 @@
net.es["is_formal"] = [False, False, True, True, True, False, True, False,
False, False]
\end{lstlisting}
-\end{docspec}
+\end{docspeca}
Already now the network can be plotted.
\begin{marginfigure}[5mm]
@@ -3365,15 +3396,15 @@
\end{tikzpicture}
\end{marginfigure}
-\begin{docspec}
+\begin{docspeca}
\begin{lstlisting}
plot(net)
\end{lstlisting}
-\end{docspec}
+\end{docspeca}
Per default, the node positions are assigned uniform random. In order to create a layout, the layout methods of the network packages can be used. Or the position of the nodes can be directly assigned, in form of a dictionary, where the key is the node id and the value is a tuple of the node position in $x$ and $y$.
-\begin{docspec}
+\begin{docspeca}
\begin{lstlisting}
layout = {0: (4.3191, -3.5352), 1: (0.5292, -0.5292),
2: (8.6559, -3.8008), 3: (12.4117, -7.5239),
@@ -3381,7 +3412,7 @@
6: (9.7608, -12.7)}
plot(net,layout=layout)
\end{lstlisting}
-\end{docspec}
+\end{docspeca}
\begin{marginfigure}[5mm]
\centering
@@ -3412,11 +3443,11 @@
We can simply re-using the previous layout object here, but we also specified that we need a bigger plot ($8 \times 8$ cm) and a larger margin around the graph to fit the self loop and potential labels (1 cm).\footnote{Per default, all size values are based on cm, and all line widths are defined in pt units. With the general option \docopt{units} this can be changed, see Section \ref{sec:plot_function}.}
-\begin{docspec}
+\begin{docspeca}
\begin{lstlisting}
plot(net, layout=layout, canvas=(8,8), margin=1)
\end{lstlisting}
-\end{docspec}
+\end{docspeca}
\begin{marginfigure}[5mm]
\centering
@@ -3444,7 +3475,7 @@
In to keep the properties of the visual representation of your network separate from the network itself. You can simply set up a Python dictionary containing the keyword arguments you would pass to \texttt{plot} and then use the double asterisk (\texttt{**}) operator to pass your specific styling attributes to \texttt{plot}:
-\begin{docspec}
+\begin{docspeca}
\begin{lstlisting}
color_dict = {'m': 'blue', 'f': 'red'}
visual_style = {}
@@ -3468,7 +3499,7 @@
# Plot command
plot(net,**visual_style)
\end{lstlisting}
-\end{docspec}
+\end{docspeca}
\begin{marginfigure}[5mm]
\centering
@@ -3498,17 +3529,17 @@
Beside showing the network, we can also generate the latex source file, which can be used and modified later on. This is done by adding the output file name with the ending \texttt{'.tex'}.
-\begin{docspec}
+\begin{docspeca}
\begin{lstlisting}
plot(net,'network.tex',**visual_style)
\end{lstlisting}
-\end{docspec}
+\end{docspeca}
produces
\begin{fullwidth}
\begin{minipage}{17cm}
-\begin{docspec}
+\begin{docspeca}
\begin{lstlisting}
\documentclass{standalone}
\usepackage{tikz-network}
@@ -3535,7 +3566,7 @@
\end{tikzpicture}
\end{document}
\end{lstlisting}
-\end{docspec}
+\end{docspeca}
\end{minipage}
\end{fullwidth}
@@ -3542,14 +3573,15 @@
Instead of the tex file, a node and edge list can be generates, which can also be used with the library.
-\begin{docspec}
+\begin{docspeca}
\begin{lstlisting}
plot(net,'network.csv',**visual_style)
\end{lstlisting}
-\end{docspec}
+\end{docspeca}
The node list \texttt{network\_nodes.csv}.
-\begin{docspec}
+
+\begin{docspeca}
\begin{lstlisting}
id,x,y,size,color,opacity,label,position
a,2.868,5.518,0.5,red,0.7,Alice,below
@@ -3560,10 +3592,11 @@
f,3.698,2.808,0.5,blue,0.7,Frank,below
g,5.551,1.000,0.5,blue,0.7,George,below
\end{lstlisting}
-\end{docspec}
+\end{docspeca}
The edge list \texttt{network\_edges.csv}.
-\begin{docspec}
+
+\begin{docspeca}
\begin{lstlisting}
u,v,lw,bend,Direct
a,b,1.0,-8.531,true
@@ -3577,7 +3610,7 @@
g,g,1.0,-8.531,true
g,d,1.0,-8.531,true
\end{lstlisting}
-\end{docspec}
+\end{docspeca}
\subsection{The plot function in detail}
\label{sec:plot_function}
Modified: trunk/Master/texmf-dist/tex/latex/tikz-network/tikz-network.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tikz-network/tikz-network.sty 2019-08-14 23:47:24 UTC (rev 51883)
+++ trunk/Master/texmf-dist/tex/latex/tikz-network/tikz-network.sty 2019-08-15 20:22:22 UTC (rev 51884)
@@ -2,10 +2,10 @@
% File : tikz-network.sty -- Library for plotting networks in TikZ
% Author : Juergen Hackl <hackl.j at gmx.at>
% Creation : 2017-02-28
-% Time-stamp: <Mon 2018-07-30 11:26 juergen>
-% Version : 1.0 (2018-07-30)
+% Time-stamp: <Thu 2019-08-15 10:57 juergen>
+% Version : 1.1 (2019-08-15)
%
-% Copyright (c) 2018 Juergen Hackl <hackl.j at gmx.at>
+% Copyright (c) 2019 Juergen Hackl <hackl.j at gmx.at>
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
% ============================================================================
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{tikz-network}[2018/07/30 tikz-network v1.0]
+\ProvidesPackage{tikz-network}[2019/08/15 tikz-network v1.1]
%=============================================================================
% Used packages
@@ -33,6 +33,7 @@
\RequirePackage{tikz}
\RequirePackage{datatool}
\RequirePackage{graphicx}
+\RequirePackage{trimspaces}
\usetikzlibrary{arrows}
\usetikzlibrary{positioning}
\usetikzlibrary{3d}
@@ -797,6 +798,8 @@
\edef\vertex at rgbValues{}%
% Go through each row element
\DTLforeachkeyinrow{\thisValue}{
+ % Remove leading and trailing spaces
+ \trim at spaces@in\dtlkey
\DTLifeq{\dtlkey}{id}{
% Assign vertex id to storage variable
\edef\vertex at id{\thisValue}%
@@ -970,8 +973,10 @@
{1\DefaultUnit}, position = {}, loopposition = {0}, loopshape = {90},
distance = {.5}, path = {}, fontcolor = {}, fontsize = {}, fontscale ={},}
\edef\edge at rgbValues{}%
- % Go through each row element
- \DTLforeachkeyinrow{\thisValue}{
+ % Go through each row element
+ \DTLforeachkeyinrow{\thisValue}{
+ % Remove leading and trailing spaces
+ \trim at spaces@in\dtlkey
\DTLifeq{\dtlkey}{u}{
% Assign edge id to storage variable
\edef\edge at u{\thisValue}%
@@ -1038,6 +1043,9 @@
\Edge[Network](\edge at u)(\edge at v)
}{
\ifthenelse{\not\equal{\cmdNW at edges@vertices}{}}{
+ % Generate pseudo vertices
+ \Vertices[Pseudo,NoLabel]{\cmdNW at edges@vertices}
+ % Delete existing vertices data base
\DTLifdbexists{vertices}{
\DTLgdeletedb{vertices}
}{}
Modified: trunk/Master/tlpkg/libexec/ctan2tds
===================================================================
--- trunk/Master/tlpkg/libexec/ctan2tds 2019-08-14 23:47:24 UTC (rev 51883)
+++ trunk/Master/tlpkg/libexec/ctan2tds 2019-08-15 20:22:22 UTC (rev 51884)
@@ -263,6 +263,7 @@
'clarendo', "die 'skipping, nonfree font'",
'classico', "die 'skipping, nonfree font'",
'clock', "&MAKEflatten",
+ 'clojure-pamphlet', "die 'skipping, compilation'",
'cm', "die 'skipping, frozen'",
'cm-lgc', "&MAKEcmlgc",
'cm-super', "&MAKEflatten",
More information about the tex-live-commits
mailing list