A Python 3 script that uses gnuplot, matplotlib and Google Charts to make histograms.

David Blume David Blume Minor style tweaks. ac7c54b @ 2019-02-03 19:33:36
README.md Minor style tweaks. 2019-02-03 19:33:36
make_chart.py Minor style tweaks. 2019-02-03 19:33:36
README.md

Make Chart

This is a sample Python 3 script that generates a chart a few different ways.

Getting the project

You can get a copy of this project by clicking on the ZIP or TAR buttons near the top right of the GitList web page.

You can clone from the origin with:

git clone ssh://USERNAME@dlma.com/~/git/make_chart.git

What Does it Do?

You specify one of four renderers, and it analyzes (currently) some hardcoded data..

  • none: Summary only, just print the mean, median, and standard deviation.
  • gnuplot: (default) Print an ASCII art graph.
  • matplotlib: Create a PNG file suitable for static reports and email.
  • google: A Google chart webpage with responsive features.

Here's the help text:

usage: make_chart.py [-h] [-r {none,gnuplot,matplotlib,google}]

Makes histograms from raw samples or prepared buckets.

optional arguments:
  -h, --help            show this help message and exit
  -r {none,gnuplot,matplotlib,google}, --renderer {none,gnuplot,matplotlib,google}
                        Choose a renderer: summary only, text, png, or
                        webpage.

Example text rendering

40 +-------------------------------------------------------+
   |      +  * * +      +      +      +      +      +      |
   |        *  *                            Pizzas ***A*** |
35 |-+     *    *                                        +-|
   |      A     *                median = 80.00            |
30 |-+   *       A***            mean = 81.67 sdev=38.09 +-|
   |     *           A**                                   |
   |    *               A***                               |
25 |-+ A                    A**                          +-|
   |   *                       A***                        |
20 |-+*                            A**                   +-|
   |  *                                                    |
   | *                                A***                 |
15 |-*                                    A**            +-|
   | *                                       A***          |
   |*                                            A**       |
10 |*+                                              A    +-|
   |                                                 *     |
 5 |-+                                                *  +-|
   |                                                   *   |
   |      +      +      +      +      +      +      +   A  |
 0 +-------------------------------------------------------+
   20     40     60     80    100    120    140    160    180

Is it any good?

Yes.

To Do

  • Make it more general.
  • Allow data to be specified different ways.
  • Support other chart types.