×

Python Tutorial

Python Basics

Python I/O

Python Operators

Python Conditions & Controls

Python Functions

Python Strings

Python Modules

Python Lists

Python OOPs

Python Arrays

Python Dictionary

Python Sets

Python Tuples

Python Exception Handling

Python NumPy

Python Pandas

Python File Handling

Python WebSocket

Python GUI Programming

Python Image Processing

Python Miscellaneous

Python Practice

Python Programs

Python | Colorbar Label

In this tutorial, we are going to learn how to add a colour-bar label using matplotlib.pyplot.colorbar)?
Submitted by Anuj Singh, on August 05, 2020

matplotlib.pyplot.colorbar(label='Colorbar**')

Following figure shows the implementation of the same in a scatter plot.

Illustration:

Python colorbar label

Python code for colorbar label

import matplotlib.pyplot as plt
import numpy as np

x = np.arange(50)
y = np.random.randint(0,50,50)
ss = np.random.randint(0,50,50)
c = np.random.randint(0,50,50)

plt.figure()
plt.scatter(x,y, s=ss*10, c=c)
plt.title('Scatter Plot Example')
plt.colorbar(label='Color Map : Inferno')
plt.show()

Output:

Output is as figure
Advertisement
Advertisement


Comments and Discussions!

Load comments ↻


Advertisement
Advertisement
Advertisement

Copyright © 2025 www.includehelp.com. All rights reserved.