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

  • @jasonmadinya7759
    @jasonmadinya77592 жыл бұрын

    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.

  • @kiliandervaux6675
    @kiliandervaux66753 жыл бұрын

    It is very clear and simple. Thank you for the discret scale, I was look for it for a long time !

  • @emilianotca
    @emilianotca3 жыл бұрын

    Very nice. Thanks for sharing this knowledge with the community!

  • @wandafionatarehy7296
    @wandafionatarehy72962 жыл бұрын

    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😀✨

  • @kumato3638
    @kumato36382 жыл бұрын

    I loved this, please we want more

  • @allenhirahara6521
    @allenhirahara6521 Жыл бұрын

    Vary helpful tutorial with color maps. Thank you!

  • @mobinyazdani1494
    @mobinyazdani1494 Жыл бұрын

    Thanks for sharing this great video, Very helpful!

  • @vahidbahadoranfard1431
    @vahidbahadoranfard14313 жыл бұрын

    Wow .... it was amazing. it was great

  • @fatihmercan6023
    @fatihmercan60232 жыл бұрын

    Very helpful. Thanks!!

  • @Suesserto
    @Suesserto7 ай бұрын

    Thank You so Much Ma’am. You saved my assignment

  • @sorosw2980
    @sorosw2980 Жыл бұрын

    Thank you so much for making this video.

  • @ProfBeckmann
    @ProfBeckmann2 жыл бұрын

    Thanks Boss! keep it up! Very usefull!

  • @victorhugoquispe8055
    @victorhugoquispe80553 жыл бұрын

    muchas gracias , me sirvió un montón :) muy buen video

  • @thanostolias5078
    @thanostolias5078 Жыл бұрын

    Really helpful. Thank you

  • @dreamphoenix
    @dreamphoenix2 жыл бұрын

    Thank you for this.

  • @lunar888
    @lunar8889 ай бұрын

    Helpful. Thanks.

  • @zaaraouimohamed5924
    @zaaraouimohamed59243 жыл бұрын

    Thanks a lot!!!!!

  • @frankservant5754
    @frankservant57542 жыл бұрын

    Great video

  • @Raiden_Amani
    @Raiden_Amani Жыл бұрын

    Thank you so much. 💕💕

  • @prajjwalmajumder9652
    @prajjwalmajumder9652 Жыл бұрын

    I wish I had seen this video earlier... Thanks

  • @muhammadjamalahmed8664
    @muhammadjamalahmed86643 жыл бұрын

    Lovely..

  • @puluketian8336
    @puluketian8336 Жыл бұрын

    Thanks!

  • @Champignon1000
    @Champignon10003 жыл бұрын

    Thank you but what about if you have 3 color dimensions and not just 1?

  • @akashsaha3956
    @akashsaha39562 жыл бұрын

    thanks a lot

  • @shlok3172
    @shlok31723 жыл бұрын

    Thanks

  • @fadoobaba
    @fadoobaba6 ай бұрын

    when i do plt.clim, it changes colors of plot but not on the legend. wonder why?

  • @neroscr7
    @neroscr72 жыл бұрын

    Goat

  • @user-gw4jp3xg3n
    @user-gw4jp3xg3n Жыл бұрын

    W tutorial

  • @kMuhammadRayanAli
    @kMuhammadRayanAli3 жыл бұрын

    i spent 10.5 hours and finally got my answer. thanks. now i can sleep. its 2:35 am here btw UwU

  • @kishwar-ehasin4439
    @kishwar-ehasin4439 Жыл бұрын

    How can I read the color value at a specific point, say at point (11,1)?

  • @karinaadcock

    @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

  • @umairahmed5171
    @umairahmed51712 жыл бұрын

    Teach me gui csp map constraints in python

Келесі