I am searching for [free] software that can produce nice looking graphical models, e.g.
Any suggestions would be appreciated.
Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It only takes a minute to sign up.
Sign up to join this communityI am searching for [free] software that can produce nice looking graphical models, e.g.
Any suggestions would be appreciated.
I currently have a similar problem (drawing multiple path diagrams for my dissertation), and so I was examining many of the options listed here already to draw similar diagrams. Many of the listed resources for drawing such vector graphics (such as in microsoft office or google drawings) can produce really nice path diagrams, with fairly minimal effort. But, part of the reason I was unsatisfied with such programs is that I needed to produce many diagrams, with only fairly minor changes between each diagram (e.g. add another node, change a label). The point and click vector graphics tools aren't well suited for this, and take more effort than need be to make such minor changes. Also it becomes difficult to maintain a template between many drawings. So, I decided to examine options to produce such graphics programattically.
Graphviz, as was already mentioned by thias, came really close to having all the bells and whistles I wanted for my graphics (as well as quite simple code to produce them), but it fell short for my needs in two ways; 1) mathematical fonts are lacking (e.g. I'm not sure if you can label a node with the $\beta$ symbol in Graphviz, 2) curved lines are hard to draw (see this post on drawing path diagrams using Graphviz on @Stask's website). Because of these limitations I have currently settled (very happily) on using the Tikz/pgf drawing library in Latex. An example is below of my attempt at reproducing your graphic (the biggest pain was the labels in the lower right corners of the boxes!);
\documentclass[11pt]{report}
\usepackage{tikz}
\usetikzlibrary{fit,positioning}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}
\tikzstyle{main}=[circle, minimum size = 10mm, thick, draw =black!80, node distance = 16mm]
\tikzstyle{connect}=[-latex, thick]
\tikzstyle{box}=[rectangle, draw=black!100]
\node[main, fill = white!100] (alpha) [label=below:$\alpha$] { };
\node[main] (theta) [right=of alpha,label=below:$\theta$] { };
\node[main] (z) [right=of theta,label=below:z] {};
\node[main] (beta) [above=of z,label=below:$\beta$] { };
\node[main, fill = black!10] (w) [right=of z,label=below:w] { };
\path (alpha) edge [connect] (theta)
(theta) edge [connect] (z)
(z) edge [connect] (w)
(beta) edge [connect] (w);
\node[rectangle, inner sep=0mm, fit= (z) (w),label=below right:N, xshift=13mm] {};
\node[rectangle, inner sep=4.4mm,draw=black!100, fit= (z) (w)] {};
\node[rectangle, inner sep=4.6mm, fit= (z) (w),label=below right:M, xshift=12.5mm] {};
\node[rectangle, inner sep=9mm, draw=black!100, fit = (theta) (z) (w)] {};
\end{tikzpicture}
\end{figure}
\end{document}
%note - compiled with pdflatex
Now, I am already writing up my dissertation in Latex, so if you just want the image without having to compile a whole Latex document it is slightly inconveniant, but there are some fairly minor workarounds to produce an image more directly (see this question over on stackoverflow). There are a host of other benifits to using Tikz for such a project though
At this time I have not considered some of the libraries for drawing the diagrams in the statistical package R directly from the specified models, but in the future I may consider them to a greater extent. There are some nice examples from the qgraph library for a proof of concept of what can be accomplished in R.
Laura Dietz has written a very nice library for tikz that enables drawing of Bayesian Networks in latex without needing to actually use tikz directly.
To demonstrate this package, see the following example for this question:
\documentclass[11pt]{report}
\usepackage{tikz}
\usetikzlibrary{bayesnet}
\begin{document}
\begin{figure}
\centering
\tikz{ %
\node[latent] (alpha) {$\alpha$} ; %
\node[latent, right=of alpha] (theta) {$\theta$} ; %
\node[latent, right=of theta] (z) {z} ; %
\node[latent, above=of z] (beta) {$\beta$} ; %
\node[obs, right=of z] (w) {w} ; %
\plate[inner sep=0.25cm, xshift=-0.12cm, yshift=0.12cm] {plate1} {(z) (w)} {N}; %
\plate[inner sep=0.25cm, xshift=-0.12cm, yshift=0.12cm] {plate2} {(theta) (plate1)} {M}; %
\edge {alpha} {theta} ; %
\edge {theta} {z} ; %
\edge {z,beta} {w} ; %
}
\end{figure}
\end{document}
%note - compiled with pdflatex
While not exactly the same, it certainly conveys the same information and could be tweaked to better fit specific requirements. This package generates very acceptable figures without needing to learn the full tikz package.
You can't beat http://daft-pgm.org/
Daft is a Python package that uses matplotlib to render pixel-perfect probabilistic graphical models for publication in a journal or on the internet. With a short Python script and an intuitive model-building syntax you can design directed (Bayesian Networks, directed acyclic graphs) and undirected (Markov random fields) models and save them in any formats that matplotlib supports (including PDF, PNG, EPS and SVG).
Inkscape is essentially a free version of Adobe Illustrator, and is a very strong program for doing vector graphics, like the picture you posted. It also plays rather nicely with most statistical packages for doing final edits/annotations/etc. to graphs - R, SAS, etc. can output a graph as a PDF or other vector format (like .eps), and then you can bring it in to Inkscape to mess about with colors, symbols, axis labels etc.
If you have a particular interest in using LaTeX, the LaTeXDraw program has some nice functionality for creating flow charts with embedded latex code.
It imports / exports PSTricks code and SVG, and can also export svg, pdf, eps, jpg, png, etc. It runs in Linux, Mac OS X, and Windows.
Dia is a free open source program for drawing diagrams. I find it useful and it's not too difficult to get started.
I have found Diagrammix to be a very flexible package, available for Mac OS X. It is a well rounded vector graphics package and does a good job at graphical models. It is fairly inexpensive and has some good add-ons that have helped improve the shapes and directions of edges.
Diagrammix
like some answers did.
$\endgroup$
You could try Google Docs Draw. It looks like it will do what you want for free, right in your browser.
You can also use the Lucidchart webapp.
I've used it in the past for drawing graphs and it's free.
SCAVIS has a Bayesian network. Try to google "scavis baysian network". The same program can draw different diagrams using Python (or Java) syntax.
you can use draw.io and use one or their many templates to create these icons. It helps you create SVGs or any other format. and does not require you to install anything on your system.