Ever since philosopher and mathematician René Descartes first set quill to paper to draw a line on his newfangled “Cartesian plane” in the 17th century, people have sought ever-cleverer ways to represent data in a pictorial format. The reasons are obvious: A graph, chart, gauge, or map can, at a glance, show important features and trends of a data set that you might miss by poring over tables of numbers. It’s the reason why Edward Tufte’s The Visual Display of Quantitative Information is still considered the bible of data visualization almost 40 years after its first release, and why firms large and small are demanding software “dashboards” showing the real-time health of their businesses.
It’s no surprise, then, that the software development world is festooned with data visualization tools.
Python and Data Visualization
Most programming languages and database tools have some sort of data visualization library available that simplifies the job of summarizing numerical information using graphics. The Python language, in particular, has a wide variety of data visualization frameworks available; they run the gamut from general-purpose charting and graphing libraries to narrowly focused tools for a particular field.
The reasons for this plethora of Python packages are simple:
- Python is easy to learn. Novices and experienced coders alike find Python’s syntax easy and intuitive, whether for quick-and-dirty command-line scripts or complex GUI applications.
- Python is open-source. It’s free to download and install, and can be modified to suit any purpose.
- The Python ecosystem includes a wide range of data-access and web application libraries. This is important, because the easiest data visualization frameworks are pretty much useless if there’s no easy way to get at the data or serve the results to a web browser.
The rich, open-source Python landscape makes it the go-to environment for data visualization, particularly for web applications.
A Brief Tour of Python’s Data Visualization Frameworks
There are far too many Python data visualization frameworks out there to describe them all in a single article. Here, in no particular order, we touch on some of the most popular libraries and what makes them good for web applications.
- Bokeh: Bokeh supports many types of graphs and charts, can render output in several static and interactive formats, and can handle streaming and real-time data. Perhaps best of all, Bokeh has three sets of methods: a high-level set, where many graph parameters are set to default values; an intermediate set, which enables more control over the parameters; and an expert set, where the developer has to specify everything. Bokeh thus caters to all levels of expertise.
- Pandas: This tool is optimized for visualizing tabular data as static plots and charts. It’s easy to use but, on its own, provides only basic functionality. Pandas can be used in combination with other frameworks to create a wider range of visualizations.
- Matplotlib: The granddaddy of all Python visualization frameworks, matplotlib is powerful (offering complete control over all aspects of a graph or chart), but as a result is more difficult to learn.
- Seaborn: Somewhere between Pandas and matplotlib is Seaborn, which is actually a “wrapper” for matplotlib that hides some of matplotlib’s complexities. It’s popular for its wide range of supported graph types and style palettes.
- Pygal: This tool is similar to Bokeh in that it can create attractive, interactive, web-ready graphics. It can also generate scalable vector graphics (SVG)-formatted images, which have the advantage of looking good at any magnification (no pixelation or “jaggy” edges).
- Plotly: Plotly is technically not a framework; it’s an online visualization tool that provides APIs for several different languages, including Python. Graphs created with Plotly are posted on the Plotly website. It’s considered the most powerful tool for interactivity.
This short list only scratches the surface of what’s available for Python. There are dozens more, including those that specialize in geographic maps and statistical charts. This rich variety of tools addresses all visualization needs and skill levels.
At AndPlus, we understand the importance of data visualization and how to pack the most meaning into charts, graphs, maps, and other graphical elements. We can take raw data and transform it into actionable information. Talk to us today about your data visualization needs.