Add examples to documentation

Adding examples to the documentation page or even an example with source code on the main page would be a tremendous improvement.

Linking to gallery from there is suggested.

This would allow potential users to see if the syntax and output suits them. Linking to the gallery allows them to see what else is possible.

Together this should allow a new user to decide whether or not to learn the language, and put context behind the rest of the documentation they then consume.

There are good examples to draw from in these links:

Ideally one used would be modelling a simple real world relationship that everyone can grasp. Maybe even a use case for dot itself (come up with idea, write with dot, compile, view).

I found Drawing graphs with dot most helpful about a year ago, but no longer see it listed on the Theory/Publications nor External Resources pages.

Not sure where it should be listed in our site, but it’s still live at

I would expect it in the Publications list at a minimum, but would hope it gets referenced in the documentation.

You have plenty of examples under Documentation → Attributes. Direct link: Attributes | Graphviz

Drawing graphs with dot is found here: Documentation/Layout Engines/dot/PDF Manual (dot | Graphviz).
Kind of hard to find.

Nice! Agreed though, hard to find.


Those are very nice, but for a new user, they are not front and center, and the output of the examples is not in-page. I would expect the output and then “Edit in playground” below that to further tinker.

Now that I know what that button does I understand (and very much appreciate) its use, but it’s still another page to load. As a newcomer, nothing would compel me to click that button, because I don’t want to edit, I want to see the output.

Attributes is not where I would click if I was seeking some quick example code and output.

Here is a nice example of what I mean. They have a getting started page and right off the bat you get working code and see the output with no further interaction:

Here is an example with code and output on the main page (5 to scroll through):

And some more with syntax and output on the main page:

I came across this online:

Might be cool to reproduce for this use. I gave it a shot here.

Would expect this on mainpage:

digraph pursuit_of_happiness {
  happy [label="Are you\nhappy?", style="bold"]
  yes1 [label="Yes"]
  no1 [label="No"]
  yes2 [label="Yes"]
  no2 [label="No"]
  want [label="Do you want\nto be happy?"]
  change [label="Change.", style="bold"]
  maintain [label="Maintain.", style="bold"]

  happy -> yes1 -> maintain
  happy -> no1 -> want -> {yes2, no2}
  yes2 -> change
  no2 -> maintain

Or even just putting code to the left of what’s already on the mainpage:

I think that would be a great idea. Would you like to send a merge request? There is an “edit this page” button. Bare in mind on mobile we might not be able to fit code left of the graph; it may have to wrap.

Glad you think so! I don’t have the time to tinker and am not too concerned with getting credit for the idea. If it helps more people find the usefulness of dot, then I’m happy.

I noticed the app icon on the main page insinuates the proposed concept.