How to save a chart figure in Matplotlib and Seaborn?

In today’s data visualization tutorial we’ll learn how to save a Matplotlib plot as a graphic file so you can later on embed into a website, presentation, Excel spreadsheet or documents. Creating our Matplotlib chart We’ll first go ahead and create our plot using Python and Matplotlib. Note that we’ll also use Numpy to generate … Read more

How to plot multiple lines with Python, Seaborn, Pandas and Matplotlib?

Today we’ll learn to draw a bit more sophisticated lineplots that display multiple lines. We’ll provide examples leveraging the two popular Python Data Visualization libraries: Seaborn and Matplotlib. Plot multiple lines with Matplotlib and Seaborn To create a line plot showing multiple lines with Matplotlib or Seaborn proceed as following: Importing Data Visualization libraries Create … Read more

How to add text point labels to Matplotlib and Seaborn?

In today data visualization we’ll show hot you can quickly add label to data points to a chart that would like to display. We’ll show how to work with labels in both Matplotlib (using a simple scatter chart) and Seaborn (using a lineplot). Add labels to Matplotlib and Seaborn plots Use the plt.annotate() function in … Read more

How to modify chart legends with Python and Matplotlib?

It goes without saying that legends help to clarify our charts and stress the message we want to convey with our analysis. In today’s tutorial we’ll learn how to show and customize plot legends with Python. Create example data We’ll start by importing the required Pandas Data Analysis libraries and creating the dataset for our … Read more

How to plot a line chart in Python with Matplotlib and Pandas?

In today’s data visualization tutorial we’ll learn how to quickly plot line charts using Python as well as the Matplotlib and Pandas libraries. Importing Python charting libraries Let’s get started by importing the required libraries into our Python development environment. I use Jupyter Lab, but you can use other notebooks or Python IDEs. Creating a … Read more

How to create a Scatter plot in Pandas with Python?

Here’s how to quickly render a scatter chart using the data visualization Matplotlib library. This assumes that you have already defined X and Y column data: Python scatter plots example – a step-by-step guide Importing libraries We will start by importing libraries and setting the plot chart: Creating data for the Chart We’ll define the … Read more

How to plot DataFrame groupby values?

Today we’ll learn how to quickly plot a chart to easily visualize aggregated data. We’ll first go ahead and create a DataFrame from data that we have aggregated. If you want to follow along this example, you can download the source csv file from this location. The tutorial assumes that you have placed the hr_data.csv … Read more

How to solve the no module named Seaborn error in Python?

Today’s tutorial is dedicated to solving import errors related to the Seaborn data visualization module. Module not found errors are typically ubiquitous when starting to work with a new Python library (think Pandas, numpy, requests, Matplotlib and others) in your development environment, or when you are installing a new environment from scratch either manually or … Read more