Cmap and ColorBar in Scatter Plot using Matplotlib

Machine Learning courses with 100+ Real-time projects Start Now!!

Program 1

import matplotlib.pyplot as mat
x=[0,1,2,3,4,5]
y=[0,1,4,9,16,25]
#mycolor=['red','blue','green','black','blue','yellow']
mycolor=[10,20,30,40,50,60]
mysize=[100,250,150,200,300,250]
mat.scatter(x,y,c=mycolor,s=mysize,cmap="Accent")
mat.colorbar()
mat.show()

 

Did we exceed your expectations?
If Yes, share your valuable feedback on Google

courses
Image

TechVidvan Team

TechVidvan Team provides high-quality content & courses on AI, ML, Data Science, Data Engineering, Data Analytics, programming, Python, DSA, Android, Flutter, full stack web dev, MERN, and many latest technology.

Leave a Reply

Your email address will not be published. Required fields are marked *