Python Forum
Matplotlib multiple set_over / under
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Matplotlib multiple set_over / under
#1
Hey,

I'm plotting gradients of a surface. Most of them lay between 0 -1, but there are also a few from 1 - 700.

Right now im coloring gradients > 1 in matplotlib via the set_over function

label_schriftgroesse = 20
schriftart = "Courier"

fig, ax = plt.subplots(figsize=(30,15))

custom_cmap = copy.copy(cm.get_cmap("gray"))
custom_cmap.set_over(color=[1,1,0])

plt.imshow(G_np, cmap = custom_cmap, 
           origin="lower",
           vmax = 1,
           extent=[x_koordinaten_np[0],x_koordinaten_np[-1],       # X-Werte
                   y_koordinaten_np[0],y_koordinaten_np[-1]],      # y-Werte
            interpolation='none')

ax.set_xlabel('x [mm]', fontsize=label_schriftgroesse, fontname = schriftart)
ax.set_ylabel('y [mm]', fontsize=label_schriftgroesse, fontname = schriftart)

clb = plt.colorbar(extend = 'max')


clb.set_label("z [mm]", fontsize=label_schriftgroesse, fontname = schriftart)
plt.show()
giving me the attached picture below.


actually it would be great not just to plot everything >1 in one colour, but plotting for example values between 1-100 green, 100-200 blue etc etc.

How can i achieve that?

Attached Files

Thumbnail(s)
   
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Matplotlib: How do I convert Dates from Excel to use in Matplotlib JaneTan 1 3,260 Mar-11-2021, 10:52 AM
Last Post: buran
  Multiple plots with matplotlib - looping j.crater 7 80,530 Sep-23-2016, 06:27 AM
Last Post: j.crater

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020