Python graphics libraries for data visualization


The Python Data Analysis (Pandas) Library is available under a BSD-style license. The name is derived from "panel data" and suits multidimensional structured data. The developers have optimized Pandas for speed and therefore implemented critical sections of code in Cython and C. Cython is an optimizing static compiler for Python and the advanced programming language of the same name. It creates compiled C programs that run several times faster than the source code in the Python interpreter.

Listing 3

Pandas Plot


Figure 7 compares the frequency of selected children's names; see Listing 3 for the corresponding code. After defining the required modules (Lines 1 to 3), you set the data to be visualized. Lines 5 and 6 define two lists, one with the name and another with the respective frequency.

Figure 7: Frequency of children's names.

Using the internal Python functions list and zip, line 7 creates a two-dimensional dataset, from which Pandas generates a view in line 9. You need to assign the collected data to the data parameter, the data labels to columns, and the names defined in line 5 to index.

Pandas renders the frequency of the name along the y axis while outputting the name in the corresponding bar on the x axis as an identifier. The call in line 10 uses df.plot() and the parameter kind='bar' to produce the chart.


The Matplotlib, PyQtGraph, Bokeh, and Pandas libraries can help programmers convert abstract data to clear-cut representations with a reasonable amount of effort. Basic knowledge of Python considerably simplifies the use of these visualization libraries. If you are looking to create a specific look, you might need to experiment.

The featured libraries provide extensive capabilities and require a careful reading of the API to set the parameters correctly. Thus, you need patience and the motivation to work through the detailed documentation. The supplied examples will help you familiarize yourself with the order and effect of the calls.


  1. Matplotlib:
  2. PyQtGraph:
  3. Bokeh:
  4. Pandas:
  5. Perl module PLplot:
  6. Perl module Chart::Clicker:
  7. Perl module GD::Graph:
  8. GD library (PHP):
  9. JpGraph (PHP):
  10. JavaScript InfoVis Toolkit:
  11. D3:
  12. Crossfilter:
  13. jqPlot:
  14. jQuery-Visualize:
  15. Flot:
  16. R:
  17. Data visualization tools:
  18. "The 38 best tools for data visualization" by By Brian Suda and Sam Hampton-Smith:
  19. "What's new in Python 3" by Rainer Grimm, Linux Pro Magazine, issue 107, October 2009, pg. 42,
  20. Basemap:
  21. Cartopy:
  22. IPython Notebook:
  23. Jupyter Notebook:
  24. PyQt on the Python wiki:
  25. PySide on the Qt wiki:
  26. Bokeh examples:
  27. CPK color model:

The Author

Frank Hofmann ( works in Berlin as a service provider at B¸ro 2.0, an open source experts' network specializing in printing and typesetting. Since 2008, he has coordinated the regional meeting of LUGs from the Berlin-Brandenburg Region and is coauthor of the Debian-Paketmanagement-Buch (Debian Package Management Book,

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Packet Analysis with Scapy

    The Scapy packet manipulation program lets you analyze and manipulate packets to create incident response reports or examine network security.

  • Perl: Google Chart Instructions

    A CPAN module passes drawing instructions in object-oriented Perl to Google Chart, which draws visually attractive diagrams.

  • Nmon

    Administrators often assume that if all nodes are functioning, the system is fine. However, a common problem is poor or unexpected application performance. In this case, you need a simple tool to help you understand what's happening on the nodes: nmon.

  • JSON Deep Dive

    JSON data format is a standard feature of today's Internet – and a common option for mobile and desktop apps – but many users still regard it as something of a mystery. We'll take a close look at JSON format and some of the free tools you can use for reading and manipulating JSON data.

  • Panda3D

    Several free game engines are available for Linux users, but programming with them is often less than intuitive. Panda3D is an easy-to-use engine that is accessible enough for newcomers but still powerful enough for the pros at Disney Studios.

comments powered by Disqus

Direct Download

Read full article as PDF:

Price $2.95