Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Graphviz (http://www.graphviz.org/) is an exceptionally effective package for drawing graphs of all kinds. Its internal node labelling facility is relatively primitive, but as it allows images to be used as labels, one can produce beautiful graphs using LaTeX to generate appropriate images and then calling Graphviz. I have got this to work by

  1. Using LaTeX to generate a PDF with one image on each page
  2. Using ImageMagick convert to convert the PDF into a series of PNGs
  3. Including the PNGs in input to Graphviz's 'dot' utility.

The results are nice, but it is clear that using a raster format in step 2-3 is visibly degrading the results. I would like to use a vector format instead. Unfortunately, AFAICS, Graphviz does not accept eps and LaTeX does not generate svg. Can anyone see a viable series of tools to get this to work?

(This list of input formats accepted by Graphviz may help: http://www.graphviz.org/doc/info/output.html#d:image_fmts)

NB. I am aware that Graphviz has some limited facility for accepting LaTeX node labels. I am however using pretty complicated drawings.

Edit: here's an example of the kind of thing I'm drawing... http://people.ds.cam.ac.uk/mg262/derivation404.png

share|improve this question
    
If the purpose is to export figures from Graphviz to LaTeX, you probably may need to have a look to the dot2texi package that allows to export the image into pgf, tikz or pstricks code. From that point on one could insert labels very easily. –  Claudio Fiandrino Sep 13 '12 at 16:14
    
No... the purpose is to export labels from LaTeX to Graphviz. The png I linked to above may make it clearer. –  Mohan Sep 14 '12 at 15:22
    
Isn't it possible to generate .ps's with preview and dvips and then feed it to dot? –  Andrew Zabavnikov Jul 23 at 15:51

2 Answers 2

One way would be to generate eps from graphviz with arbitrary simple labels and then insert LaTeX typeset labels using psfrag.

share|improve this answer
    
But then graphviz would have to draw the graph without knowing the sizes of the different labels... that would significantly degrade the layout of the graph. –  Mohan Sep 14 '12 at 15:20
1  
ah true, well an alternative if I understand that linked diagram would be to generate svg from latex and use that. You could either use latex to get dvi followed by dvisvg(m) or you could use convert or something to convert latex generated eps or pdf to svg –  David Carlisle Sep 14 '12 at 15:27
    
Thanks for the suggestions. dvisvgm: output svgs are unfortunately a mess (as viewed from InkScape). Also, ImageMagick's convert is rasterising during pdf -> svg. Ah well... –  Mohan Sep 14 '12 at 16:53

A recent release of dot2tex claims to use the latex "preview" package to get size information about the label, draw the graph with that information, then export the whole thing to latex. If your ultimate goal is to put the graph in latex, this may be an option. Probably take some funky latex page size setup for the size of graph you're working with.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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