Skip to Content

Piyush is a data scientist passionate about using data to understand things better and make informed decisions. In the past, he's worked as a Data Scientist for ZS and holds an engineering degree from IIT Roorkee. His hobbies include watching cricket, reading, and working on side projects.

How to remove the legend border (frame) in Matplotlib?

The matplotlib library is a charting library in Python that allows you to plot highly customizable plots. In this tutorial, we will look at how to remove the border (or, the frame) of the legend in a matplotlib plot. By default, when you create a plot in matplotlib with a legend, the contents of the …

Read More about How to remove the legend border (frame) in Matplotlib?

How to change the legend position in Matplotlib?

In this tutorial, we will look at how to change the legend position inside a matplotlib plot with the help of some examples. You can use the loc keyword parameter in the matplotlib.pyplot.legend() function to specify the location of the legend in a matplotlib plot. There are different location values that you can pass to …

Read More about How to change the legend position in Matplotlib?

How to make text italic in a Matplotlib plot?

In this tutorial, we will look at how to italicize text appearing in different parts of a matplotlib plot with the help of some examples. To use italic text in a matplotlib plot, you can use the keyword argument fontstyle and pass ‘italic’ as its value when adding different texts to a plot. For example, …

Read More about How to make text italic in a Matplotlib plot?

Matplotlib – Remove the frame without altering the ticks and the tick labels

To remove the rectangular frame of a matplotlib plot, you can use the respective axes object’s set_frame_on() function and pass False as an argument. This will remove the rectangular bounding box but will not alter the ticks and tick labels. Example 1 – Remove the frame from a plot Let’s look at an example. First, …

Read More about Matplotlib – Remove the frame without altering the ticks and the tick labels

Add Title to Each Subplot in Matplotlib

In this tutorial, we will look at how to add a different title to each subplot in matplotlib with the help of some examples. When you’re working with a single plot, you can use the matplot.pyplot object’s title() method to set its title. To set the titles for subplots, however, you have to use the …

Read More about Add Title to Each Subplot in Matplotlib