79394994

Date: 2025-01-28 19:45:57
Score: 0.5
Natty:
Report link

just to clarify the question asked running on Online Matplotlib Compiler

code:

import matplotlib.pyplot as plt
import numpy as np
import matplotlib

print(matplotlib.__version__)

t = np.linspace(0, 5, 301)  # Ajouter un point pour les bords
f = np.linspace(-10, 10, 501)  # Ajouter un point pour les bords

valeurs = np.zeros((500, 300))

#print('t :' , t)

valeurs[100:110, :] = 100
valeurs[400:440, :] = 5

valeurs[valeurs==0 ] = np.nan

fig = plt.pcolormesh(t, f,valeurs, norm=matplotlib.colors.Normalize(clip=True))
#plt.pcolormesh(valeurs) #Give the same result except on axis marks.

#plt.imshow(valeurs, interpolation='bilinear', origin='lower', extent=[t[0], t[-1], f[0], f[-1]], aspect='auto')

print(matplotlib.scale.get_scale_names())
plt.show()

Output:

3.5.2
['function', 'functionlog', 'linear', 'log', 'logit', 'symlog']

plot:

enter image description here

Does using : valeurs[valeurs==0 ] = np.nan

in :

import matplotlib.pyplot as plt
import numpy as np

t = np.linspace(0, 5, 301)  # Ajouter un point pour les bords
f = np.linspace(-1000, 1000, 501)  # Ajouter un point pour les bords

valeurs = np.zeros((500, 300))



valeurs[100, :] = 10
valeurs[400, :] = 10

valeurs[valeurs==0 ] = np.nan

plt.pcolormesh(t,f,valeurs)
#plt.pcolormesh(valeurs) #Give the same result except on axis marks.
plt.show()

pic:

enter image description here

improves your output ??

Reasons:
  • Probably link only (1):
  • Long answer (-1):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • High reputation (-1):
Posted by: pippo1980