Python graphics libraries for data visualization
Pandas
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.
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.
Conclusions
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.
Infos
- Matplotlib: http://matplotlib.org/
- PyQtGraph: http://www.pyqtgraph.org/
- Bokeh: http://bokeh.pydata.org/en/latest/
- Pandas: http://pandas.pydata.org/
- Perl module PLplot: http://plplot.sourceforge.net/index.php
- Perl module Chart::Clicker: https://metacpan.org/pod/Chart::Clicker
- Perl module GD::Graph: https://metacpan.org/pod/GD::Graph
- GD library (PHP): http://php.net/manual/en/book.image.php
- JpGraph (PHP): http://jpgraph.net/
- JavaScript InfoVis Toolkit: http://philogb.github.io/jit/
- D3: https://d3js.org/
- Crossfilter: http://square.github.io/crossfilter/
- jqPlot: http://www.jqplot.com/
- jQuery-Visualize: https://github.com/filamentgroup/jQuery-Visualize
- Flot: http://www.flotcharts.org/
- R: https://www.r-project.org/
- Data visualization tools: http://selection.datavisualization.ch/
- "The 38 best tools for data visualization" by By Brian Suda and Sam Hampton-Smith: http://www.creativebloq.com/design-tools/data-visualization-712402
- "What's new in Python 3" by Rainer Grimm, Linux Pro Magazine, issue 107, October 2009, pg. 42, http://www.linuxpromagazine.com/Issues/2009/107/Python-3
- Basemap: http://matplotlib.org/basemap/
- Cartopy: http://scitools.org.uk/cartopy/docs/latest/
- IPython Notebook: https://ipython.org/ipython-doc/3/notebook/notebook.html
- Jupyter Notebook: http://jupyter.org/index.html
- PyQt on the Python wiki: https://wiki.python.org/moin/PyQt
- PySide on the Qt wiki: http://wiki.qt.io/PySide
- Bokeh examples: http://bokeh.pydata.org/en/latest/docs/gallery/periodic.html
- CPK color model: https://en.wikipedia.org/wiki/CPK_coloring
« Previous 1 2
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you've found an article to be beneficial.
News
-
elementary OS 7.1 Now Available for Download
The team behind elementary OS has released the latest version of its operating system with a focus on personalization, inclusivity, accessibility, and privacy.
-
The GNU Project Celebrates Its 40th Birthday
September 27 marks the 40th anniversary of the GNU Project, and it was celebrated with a hacker meeting in Biel/Bienne, Switzerland.
-
Linux Kernel Reducing Long-Term Support
LTS support for the Linux kernel is about to undergo some serious changes that will have a considerable impact on the future.
-
Fedora 39 Beta Now Available for Testing
For fans and users of Fedora Linux, the first beta of release 39 is now available, which is a minor upgrade but does include GNOME 45.
-
Fedora Linux 40 to Drop X11 for KDE Plasma
When Fedora 40 arrives in 2024, there will be a few big changes coming, especially for the KDE Plasma option.
-
Real-Time Ubuntu Available in AWS Marketplace
Anyone looking for a Linux distribution for real-time processing could do a whole lot worse than Real-Time Ubuntu.
-
KSMBD Finally Reaches a Stable State
For those who've been looking forward to the first release of KSMBD, after two years it's no longer considered experimental.
-
Nitrux 3.0.0 Has Been Released
The latest version of Nitrux brings plenty of innovation and fresh apps to the table.
-
Linux From Scratch 12.0 Now Available
If you're looking to roll your own Linux distribution, the latest version of Linux From Scratch is now available with plenty of updates.
-
Linux Kernel 6.5 Has Been Released
The newest Linux kernel, version 6.5, now includes initial support for two very exciting features.