Recommendation for drawing graphs and creating tables, saving as PDF

Chris Nyland menyland at gmail.com
Sat Jun 12 13:19:43 EDT 2021


If you don't want to have to do any layout, Graphviz, which you mentioned,
is probably the best and there are/were Python libraries that will let you
control it to automatically produce files. The whole point of graphviz is
to do all the layout, however my only grip is it doesn't always make the
best choices and then it is a bit of a burden to get it to do what you
want. That was also years ago though so maybe the functionality has
expanded. I used it then to create huge hierarchical graphs. Additionally
Graphviz is more like a framework and there are in reality many backends to
choose from. I started to look into this to see if there were backends that
made more sense for my charts but the project lost steam and I never got
back to it.

That would be my recommendation and then like Martin said use Markdown plus
pandoc. I have been using this system for years at work and it works really
well. I will write up specifications and requirements in mark down so I can
version control them in Git then I use Markdown to convert to Word and PDF
to distribute to coworkers. If they make changes I just convert the files
back to mark down and then I can use KDiff and other merge tools to review
the changes and commit them if I want. Graphviz will export PNGs which you
can embed easily in markdown.

Graphviz can also work by typing up a simple viz file which is just text
and then that file is compiled into the visualization. That text file can
of course be version controlled which if you can't tell I am big on so this
is another bonus for me.

Chris

Chris

On Fri, Jun 11, 2021 at 10:35 PM Martin Di Paola <martinp.dipaola at gmail.com>
wrote:

> You could try https://plantuml.com and http://ditaa.sourceforge.net/.
>
> Plantuml may not sound as the right tool but it is quite flexible and
> after a few tweak you can create a block diagram as you shown.
>
> And the good thing is that you *write* which elements and relations are
> in your diagram and it is Plantuml which will draw it for you.
>
> On the other hand, in Ditaa you have to do the layout but contrary to
> most of the GUI apps, Ditaa processes plaintext (ascii art if you want).
>
> For simple things, Ditaa is probably a good option too.
>
> Finally, I use https://pandoc.org/ to transform my markdowns into PDFs
> for a textbook that I'm writing (and in the short term for my blog).
>
> None of those are "libraries" in the sense that you can load in Python,
> however nothing should prevent you to call them from Python with
> `subprocess`.
>
> By the way, I'm interesting too in to know other tools for making
> diagrams.
>
> On Fri, Jun 11, 2021 at 08:52:20AM -0400, Neal Becker wrote:
> >Jan Erik Moström wrote:
> >
> >> I'm doing something that I've never done before and need some advise for
> >> suitable libraries.
> >>
> >> I want to
> >>
> >> a) create diagrams similar to this one
> >> https://www.dropbox.com/s/kyh7rxbcogvecs1/graph.png?dl=0 (but with more
> >> nodes) and save them as PDFs or some format that can easily be converted
> >> to PDFs
> >>
> >> b) generate documents that contains text, lists, and tables with some
> >> styling. Here my idea was to save the info as markdown and create PDFs
> >> from those files, but if there is some other tools that gives me better
> >> control over the tables I'm interested in knowing about them.
> >>
> >> I looked around around but could only find two types of libraries for a)
> >> libraries for creating histograms, bar charts, etc, b) very basic
> >> drawing tools that requires me to figure out the layout etc. I would
> >> prefer a library that would allow me to state "connect A to B", "connect
> >> C to B", "connect B to D", and the library would do the whole layout.
> >>
> >> The closest I've found it to use markdown and mermaid or graphviz but
> >> ... PDFs (perhaps I should just forget about PDFs, then it should be
> >> enough to send people to a web page)
> >>
> >> (and yes, I could obviously use LaTeX ...)
> >>
> >> = jem
> >
> >Like this?
> >https://pypi.org/project/blockdiag/
> >
> >--
> >https://mail.python.org/mailman/listinfo/python-list
> --
> https://mail.python.org/mailman/listinfo/python-list
>


More information about the Python-list mailing list