# Cross platform create reports from text files

I use GraphViz for a lot of things, but it won't work for what I have in mind. I am looking for something similar for report generation.

I want a tool which takes text files - I don't care which format, probably some command language of its own - and generates graphical files.

Must have
- gratis
- takes its input form a text file
- histograms
- PNG, JPG

Nice to have
- I have a strong preference for cross-platform, but might be able to live with a Windows only solution if there is nothing cross platform or if the Windows solution is far superior in features
- pie charts
- numerical grids/tables
- other chart types
- other fancy reporting stuff(?)
- lots of options, such as colo(u)rs, titles, labels, etc
- SVG
- PDF
- wide user community, with good support, examples and documentation
- well established, stable & well tested
- anythin else that you can think of

There are lots of Python graph drawing libraries that allow you to very quickly generate graphs and either display or save them. A good starting point is matplotlib. N.B. For ease of installation on Windows you might like to take a look at PythonXY which includes both Python, Pandas and Matplotlib, plus a lot more.

• gratis - Yes & Open Source
• takes its input form a text file - Yes The graph drawing instructions are python which is a text file and the data can be almost any format or source.
• Interactive Use - Yes
• histograms - Yes
• PNG, JPG - PNG definitely, JPG if you have PIL or Pillow installed
• pie charts - Yes and polar

• numerical grids/tables - Yes
• other chart types - 100s
• other fancy reporting stuff - Lots Especially if you throw pandas into the mix!

• lots of options, such as colo(u)rs, titles, labels, etc - Yes

• SVG - Back end dependent
• PDF - Yes
• Cross platform - Yes - Very
• wide user community, with good support, examples and documentation - Very
• well established, stable & well tested - Yes It has been in use by 1000s of people and development since 2002 at least. At this moment SO reports 14,934 questions with the matplotlib tag. There are several books on it's use.
• There are several matplotlib add-on toolkits, including a choice of two projection and mapping toolkits basemap and cartopy, 3d plotting with mplot3d, axes and axis helpers in axes_grid and more.

3D Plot Example:

>>> from matplotlib import cm
>>> from mpl_toolkits.mplot3d import Axes3D
>>> import matplotlib.pyplot as plt
>>> import numpy as np
>>> fig = plt.figure()
>>> ax = fig.gca(projection='3d')
>>> X = np.arange(-5, 5, 0.25)
>>> Y = np.arange(-5, 5, 0.25)
>>> X, Y = np.meshgrid(X, Y)
>>> R = np.sqrt(X**2 + Y**2)
>>> Z = np.sin(R)
>>> surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.coolwarm)
>>> plt.show()


If you are producing reports that embed charts I would strongly recommend taking a look at Jupyter & iPython notebooks. This free & open source tool chain will give you a browser based interface to generate your reports including:

• a number of graphing and plotting libraries
• Markdown cells
• MathJax for formulas
• Live data from the web
• Code Cells in Python and a number of other languages such as R, Julia, Haskell & 30+ other languages with the code being executable and the results included of the last run in your report.
• Embed Graphic & Videos from files or online sources
• Save as an iPython Notebook (Text/JSON format),
• Export to python, HTML, MarkDown, Restructured Text reST or PDF.
• Online trial here but usually you run a local server, (often on the same machine).

So you can include page layout, introductory text, data, examples, processing results, plots, images, the lot and produce a final output, to pdf, web or both, that looks really professional.

• Steve, this seems perfect, but I will leave this open to see if it attracts any more answers (which might,, for instance, benefit non-Python guys (maybe C/C++, etc); me? I love Python ). I would also like to point out to others that this is an excellent example of how to answer. You have obviously spend quite some time to provide a detailed answer which addresses each of my points and the inclusion of an example means that I don'e even have to visit the linked site in order judge whether the too is for for me or not. Thanks! – Mawg says reinstate Monica Jan 7 '16 at 8:00
• @Mawg - Thank-you for the nice words I have expanded slightly to include Jupyter which would allow full report generation and also supports other languages. – Steve Barnes Jan 7 '16 at 9:33

Gnuplot Probably deserves a mention here.

It is and old school command line application dating back to the early days of computer graphics, that used to be pretty widely used but have faded a bit from the limelight with the emergence of IPython.