5

The de-facto plotting program for LaTeX is, AFAIA, gnuplot.

Is there such a program for drawing graphs/diagrams? I am aware of graphviz and at first glance it appears very useful, but it is missing certain basic features such as specifying multiple rank orders (arrange left to right, top to bottom... see here) or subscripts/superscripts. It apparently allows for html formatting which in theory provides for subscripts/superscripts, but it does not seem to work. dot2tex attempts to make graphviz more LaTeX friendly, but the generated graphs are not as sharp, C style comments, which are valid in graphviz files, appear to conflict with LaTeX files, even when included as a doc file, and I, personally, can't figure out how to embed the graph as a figure as opposed to a dangling graph.

Is there a way to address some of these shortcomings:

  • no sub/superscripts
  • no figures
  • no comments

If not, is there a way to output the file to a more LaTeX friendly format, much like gnuplot does with its latex format, such that I can use LaTeX's math mode?

EDIT here are two pictures to better describe what I mean by graphs and/or diagrams

Diagram 1

Diagram 2

9

4 Answers 4

10

As the commenters mentioned, TikZ can do these graphics and use the full power of LaTeX. A main advantage is that, unlike pstricks, the package works for all output drivers, most notably PS and PDF. Everything will compile with just one (or two) latex/pdflatex run(s), no extra setup required. Not to mention the plethora of features described in the excellent 700+ pages manual (with tutorial).

While we're at it, try R and its TikZ device for plotting.

1
  • 3
    That manual should be slapped in the face of every first year computer scientist until they adopt its style entirely! I have never seen a tutorial that great. Not on w3schools, not on wikipedia, not even in strategy guides. +1,000,000
    – puk
    Feb 2, 2012 at 21:01
3

The best tool is John Hobby's MetaPost, that can use a TeX engine (with whatever format: plain, LaTeX, and so on) [or by the way a troff engine too...] for the layout of "labels", and propose all the features of a programming/scripting language METAFONT like with a PostScript output. I use this for almost all my drawings; and to create easily legends and layout for maps---MetaPost can be considered as a PostScript scripting language too; so really handy to program the customization of maps.

MetaPost is a fantastic tool. To be found in, I think, all the TeX distributions---and of course: kerTeX.

The caveat is that to "see" the result, one needs a PostScript interpreter---while with METAFONT, you have also a rasterizer. (I even think that it could be useful in the future, for kerTeX, whether to develop a "MostScript", that is a PostScript limited interpreter able to render MetaPost figures; or to add back the rasterizing capabilities of METAFONT in MetaPost to be free from the need of a PostScript interpreter (software or "hardware" [printer]).

1
  • Asymptote has C++-like syntax to define points by equations (like MetaPost).
    – vonbrand
    Jan 17, 2013 at 1:44
2

diagrams is a domain-specific language for creating vector graphics using Haskell. It has several backends that allow for direct embedding into LaTeX files. As an example, take a look at the diagrams in Brent Yorgey's PhD thesis, that are all done with this library (you can see the examples in the pdf... jump to the diagrams linked in the List of Figures (the sources are available in the repository)).

1

As a complement to the tikz libraries available, there are numerous pstricks examples, for 2D and 3D representations.

Since the images you present looks like flowcharts, see the flowchart gallery.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .