Scatter plot with third variable as color | Python Matplotlib
Ғылым және технология
How to make and customize a color map and color bar in python
Choosing Colormaps in Matplotlib:
matplotlib.org/3.1.0/tutorial...
-------------------------------------------------------------------------------------------------------------------
import matplotlib.pyplot as plt
x = [1,2,3,4,5,6,7,8,9,10,11]
y = [1,1,1,1,1,1,1,1,1,1,1]
colors = [1,2,3,4,5,6,7,8,9,10,100]
plt.scatter(x,y, s=200, c=colors, cmap=plt.cm.get_cmap("cool",5))
cbar = plt.colorbar(orientation="vertical", extend="both",
pad=0.05, shrink=1, aspect=20, format="%.3f")
cbar.set_label(label="Concentrations", size=15)
cbar.set_ticks([0,5,10])
cbar.set_ticklabels(["0 grams","5 million","cats"])
cbar.ax.tick_params(labelsize=15)
plt.clim(0,10)
plt.cm.[TAB]
plt.show()
Пікірлер: 33
This was super helpful, thanks for going through the various options to customize, too many tutorial videos only show the simplest most straightforward uses for something.
It is very clear and simple. Thank you for the discret scale, I was look for it for a long time !
Very nice. Thanks for sharing this knowledge with the community!
Thank you so much, you made it easy to understand for beginners, like me. I've been looking for this since I got a homework for velocity model using Python. Now I got this😀✨
I loved this, please we want more
Vary helpful tutorial with color maps. Thank you!
Thanks for sharing this great video, Very helpful!
Wow .... it was amazing. it was great
Very helpful. Thanks!!
Thank You so Much Ma’am. You saved my assignment
Thank you so much for making this video.
Thanks Boss! keep it up! Very usefull!
muchas gracias , me sirvió un montón :) muy buen video
Really helpful. Thank you
Thank you for this.
Helpful. Thanks.
Thanks a lot!!!!!
Great video
Thank you so much. 💕💕
I wish I had seen this video earlier... Thanks
Lovely..
Thanks!
Thank you but what about if you have 3 color dimensions and not just 1?
thanks a lot
Thanks
when i do plt.clim, it changes colors of plot but not on the legend. wonder why?
Goat
W tutorial
i spent 10.5 hours and finally got my answer. thanks. now i can sleep. its 2:35 am here btw UwU
How can I read the color value at a specific point, say at point (11,1)?
@karinaadcock
Жыл бұрын
Try the code below. I used this webpage to work it out. stackoverflow.com/questions/47908429/get-color-of-a-scatter-point import matplotlib.pyplot as plt import matplotlib.colors as cl x = [1,2,3,4,5,6,7,8,9,10] y = [1,1,1,1,1,1,1,1,1,1] cols = [1,2,3,4,5,6,7,8,9,10] sc = plt.scatter(x, y, c=cols, cmap='bwr') plt.show() rgba = sc.to_rgba(c[2]) # get color of third data point as RGBA print(rgba) print(cl.to_hex(rgba)) # get color as hex code
Teach me gui csp map constraints in python