Skip to main content
Flox Blog Beginner's Guide for Web Developers. 60% Off in Website Design & Development click here.

How to disable python label(label:^none) when plotting pandas data?

In this article, we will discuss the python label:^none when plotting pandas data.

By Using label=None in the plot command. In this case, matplotlib choose the key of the data as a label. Then find this behaviour unintuitive and exacted to have full control over the label when set it explicitly.

How can you disable the label of a plot involving data from a pandas data frame (label:^none)?

In below code it will fixed.

import matplotlib.pyplot as plt
import pandas as pd

df = pd.DataFrame({'x': [0, 1], 'y': [0, 1]})
plt.plot(df['x'], df['y'], label='')

In this, you just pass an empty label on your code. Matplotlib doesn’t bother making a legend entry in that case. Also not use plt.legend. The label=None(label:^none) argument is the default, which the plotting function detects, telling it to make up a label.

Leave a Reply

Notify of