52
$\begingroup$

Here is the criteria for a "perfect" graph editor:

  • it should be able to perform an automated, but controllable layout
  • one is able to make "manual" enforcements to nodes and edges locations when you need it (or at least such fine automated layout so you don't need "manual" enforcements)
  • one could add some math symbols and formulae on a graph

Common vector graphics editors could do the trick, but there is a lot of overhead efforts to draw every node, every edge, every label.

Graphviz is good enough, but sometimes you cannot get needed layout (even if you use several tricks like additional invisible nodes etc) and you should use ladot or dot2tex for math formulae

yEd has nice layouts, but there is a problem with a math text.

This is probably not a math question, but it is common to draw graphs in articles i think.

Result graph

(Update: 27.12.2010) Here is another candidate for the best editor in TeX - Asymptote (asymptote.sf.net). The very powerful tool at first glance.

(Update: 28.04.2014) The very tasty semiautomated tool to use with PGF/TiKZ is TiKZEdt. You can extend its palette with your own tools and make the process of diagram creation very simple!

$\endgroup$
4
  • $\begingroup$ It seems that someone already made it "cw". PGF/TikZ did the trick. Here is my result: [Original graph](mathtech.ru/0pocket/grf.jpg) [Result graph](mathtech.ru/0pocket/grf_res.jpg) I've found that this tool is very best and it satisfies all of the listed requirements. I will also check other proposed tools and mark them as answers if they will be as good. $\endgroup$ Feb 18, 2010 at 15:33
  • $\begingroup$ Leonid: Your final layout has vertex labels that are difficult to read because they are crossed by edges of the graph, self-loops that are so small relative to the vertex size that they look like bumps on their vertices with labels that are placed close enough to the vertices that they look like vertex labels, and arrowheads that are too small to see. I'd expect a good drawing tool to make it easy to avoid these sorts of problems. $\endgroup$ Jun 8, 2010 at 0:28
  • $\begingroup$ I've chosen such layout. However you can do any other layouts with PGF/TikZ. Check (mathtech.ru/0pocket/pn_2.png) $\endgroup$ Jun 8, 2010 at 8:35
  • $\begingroup$ And it is nontrivial to change size of arrows in the current version of PGF/TikZ. In previous versions it was simple, but now they create something like meta-font for arrows to make size of arrows more flexible. As the opposite side - it is not as easy now : ))) As soon as I get how to do it I'll put the link to my new pic here. $\endgroup$ Jun 8, 2010 at 11:26

5 Answers 5

30
$\begingroup$

I already had about 30 pages of graphs typeset with xymatrix for my thesis before discovering tikz; but was so impressed by it that I was happy to rewrite them all. As well as (imho) looking better, it gave me cross-platform compatibility - xypic seems to need pstricks, so on the mac with TeXshop (which uses pdflatex, I assume) the old graphs couldn't even be rendered.

Its ability to construct graphs iteratively can also be a massive timesaver- for instance, I wanted a bunch of otherwise identical rectangles at various positions, so with tikz could just loop over a list of their first coordinate rather than having to tediously cut,paste and modify an appropriate number of copies of the command for a rectangle. Particularly handy when I then decided they all needed to be slightly wider!

There's a gallery of tikz examples here, to give you some idea of what it's capable of (and with the relevant source code- I did find the manual a bit hard to understand and learnt mostly by examples or trial and error).

The vector graphics package inkscape (which I used to use for drawing more complicated graphs for inclusion as eps images) also apparently has a plugin to export as tikz, although I haven't tried that out.

$\endgroup$
5
  • 1
    $\begingroup$ +1 for mentioning texample; there are some fantastic examples of what TikZ can do there. In particular, there's a really nice picture of a torus ... $\endgroup$ Feb 18, 2010 at 14:26
  • $\begingroup$ Inkscape is great, it has a plugin to add latex to the images you make. With good copy pasting and once you getused to the tools it is MuCH faster than typing the diagram in xypic. Additionnally you get much more control of your diagrams. $\endgroup$
    – B. Bischof
    Feb 18, 2010 at 14:44
  • 1
    $\begingroup$ You are absolutely right about PGF/TikZ but just a minor correction - TeXshop can easily be configured to use either pdflatex to generate PDF directly or latex + dvips to generate PS (see the "Typeset" menu and choose "Tex and Ghostscript") $\endgroup$ Mar 16, 2010 at 11:40
  • $\begingroup$ Another reason to use TikZ is that it has seamless integration with the Beamer package for making slides. Now when you give subsequent talks about your big result it is easier then ever. $\endgroup$ Apr 6, 2010 at 11:20
  • 1
    $\begingroup$ @Chris: Almost as if they were designed that way ... $\endgroup$ Apr 6, 2010 at 13:34
10
$\begingroup$

For something quick (and not necessarily dirty) you can use XFig — TeX symbols are allowed, and there's quite a lot you can do (it's quite impressive how powerful this 'oldie' can be ;-).

For something more elaborate, i'd say PGF and TikZ — this is a very powerful tool, and you can virtually do whatever you want with it.

For some sort of "middle ground" approach, you can maybe try Xy-pic — this is not as old as XFig and not as new as PGF/TikZ; and used to be the standard way to go for graphs. ;-)

Hope this helps.

$\endgroup$
4
  • $\begingroup$ I'm growing to use TikZ more and more nowadays - neat, versatile and makes really pretty and easily customizable results. $\endgroup$ Feb 18, 2010 at 5:12
  • $\begingroup$ @Mikael: PGF/TikZ is a very resourceful tool, up-to-par with PSTricks and much easier than MetaPost or MetFont — or even Asymptote for that matter. ;-) $\endgroup$
    – Daniel
    Feb 18, 2010 at 5:41
  • $\begingroup$ As Daniel say, Xfig is very useful. It exists for many platforms (I use a java based version on a Mac.) I do not like the exports to Pictex, which takes an enormous amount of text to produce a curved line, and Pictex can be clunky. A great thing however is that once you get used to it you can adjust the position of any maths symbols with great precision for best visual effect. I also use xypic for basic (category style) diagrams and know that it is possible to do wonders with that... but have not learnt to ...yet! It still is the standard way for diagrams in Cat Theory. $\endgroup$
    – Tim Porter
    Feb 18, 2010 at 7:07
  • $\begingroup$ I have used XFig in the past, too, but then I replaced it with Inkscape (and later with TikZ). I think Inkscape can do everything XFig does, with more extensions and a nicer interface. Let me know if you have counterexamples to this claim. $\endgroup$ Dec 27, 2010 at 15:46
9
$\begingroup$

Graphviz is extremely powerful and I'd be surprised to discover that it doesn't do what you need. It only generates the positions of nodes that aren't already specified so if you need fine tuning then you can run it to get a basic graph, then fine tune it, and then it'll respect your fine tuning. Also, it comes with an interactive program called dotty which can be used to alter the graphs visually.

One should also distinguish between generating graphs and rendering them. I use graphviz to generate graphs, but don't use it for rendering. For that, if PGF/TikZ can't do it then I'm not interested! PGF/TikZ is absolutely fantastic and has consigned xy.sty, xfig, and all the other stuff that I used to use to the rubbish bin [trash can]. Even for commutative diagrams in category theory!

$\endgroup$
1
  • 1
    $\begingroup$ I've finally choosen PGF/TikZ for my purposes. Graphviz is nice for graphs with a simple layout. But when you try to demonstrate some vision of the idea it's not the best tool. Because its layout is too hardcoded. That's why one uses all of these tricks like invisible edges and boxes etc $\endgroup$ Mar 28, 2010 at 18:59
6
$\begingroup$

For adding math symbols I use lpic --- this way you use LaTeX to write over picture,so you can add ALL math symbols NOT just some. BONUS: if you change notation, you do not have to redo picture.

For drawing I often use some geogebra or kig. This soft is mostly designed for compass and straightedge constructions, but I use it as an advanced vector-graphic editor --- it is flexible enough to make virtually any math drawing.

$\endgroup$
5
$\begingroup$

I personnally mostly use xfig, and start moving to inkscape. However I guess that they are not what you want. A friend of mine, working on graphs, uses metapost with great results. Last, for 3D images, I use povray which is very efficient with geometric forms. It renders natively in .png, so the best is to compile with pdflatex. You can find mathematical picture rendered with povray on my web page: http://www-fourier.ujf-grenoble.fr/~bkloeckn/images.html

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.