Book Image

The Data Visualization Workshop

By : Mario Döbler, Tim Großmann
Book Image

The Data Visualization Workshop

By: Mario Döbler, Tim Großmann

Overview of this book

Do you want to transform data into captivating images? Do you want to make it easy for your audience to process and understand the patterns, trends, and relationships hidden within your data? The Data Visualization Workshop will guide you through the world of data visualization and help you to unlock simple secrets for transforming data into meaningful visuals with the help of exciting exercises and activities. Starting with an introduction to data visualization, this book shows you how to first prepare raw data for visualization using NumPy and pandas operations. As you progress, you’ll use plotting techniques, such as comparison and distribution, to identify relationships and similarities between datasets. You’ll then work through practical exercises to simplify the process of creating visualizations using Python plotting libraries such as Matplotlib and Seaborn. If you’ve ever wondered how popular companies like Uber and Airbnb use geoplotlib for geographical visualizations, this book has got you covered, helping you analyze and understand the process effectively. Finally, you’ll use the Bokeh library to create dynamic visualizations that can be integrated into any web page. By the end of this workshop, you’ll have learned how to present engaging mission-critical insights by creating impactful visualizations with real-world data.
Table of Contents (9 chapters)
7. Combining What We Have Learned

Basic Text and Legend Functions

All of the functions we discuss in this topic, except for the legend, create and return a matplotlib.text.Text() instance. We are mentioning it here so that you know that all of the properties discussed can be used for the other functions as well. All text functions are illustrated in Figure 3.13.


Matplotlib provides a few label functions that we can use for setting labels to the x- and y-axes. The plt.xlabel() and plt.ylabel() functions are used to set the label for the current axes. The set_xlabel() and set_ylabel() functions are used to set the label for specified axes.


ax.set_xlabel('X Label')
ax.set_ylabel('Y Label')

You should (always) add labels to make a visualization more self-explanatory. The same is valid for titles, which will be discussed now.


A title describes a particular chart/graph. The titles are placed above the axes in the center, left edge, or right edge. There are two...