matplotlib
içinde imshow
10 kullanarak hsv
değerlerini çizmeye çalışıyorum. Sorun, kullandığım yöntemin, hsv
için beklendiği gibi üç değer içeren bir tuple döndürmesidir, ancak imshow
bunu rgb
olarak yorumlar. imshow
'a değerlerin hsv
değerlerinin olduğunu bildirmenin bir yolu var mı? o yoğunluk değerlerine dayalı diğerlerine göre daha az doygunluk olmalıdır arsa üzerinde düzgün bazı alanlarda çalıştıysa imshow ile hsv değerlerini çizme
: Ben aşağıdaki grafik elde
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.colors as mcolors
def G(x, y):
s = x + 1j*y
return (s+2)/(s**2 + s + 1)
x = np.linspace(-3, 3, 1000)
y = np.linspace(-3, 3, 1000)
xx, yy = np.meshgrid(x, y)
norm = mcolors.Normalize()
zz = G(xx, yy)
phase = np.angle(zz)
mag = np.abs(zz)
# color converter
c = mcolors.ColorConverter().to_rgb
# Custom rgb Colormap
rgb = make_colormap(
[c('red'), c('yellow'), 0.33, c('yellow'), c('green'), c('cyan'), 0.5, c('cyan'),
c('blue'), c('magenta'), 0.833, c('magenta'), c('red')])
# Turn data points into rgb values
z_data_rgb = rgb(norm(phase))
# normalizing the intensity values
intensity = norm(mag)
# defining light source
ls = mcolors.LightSource()
# plotting
plt.imshow(ls.blend_hsv(z_data_rgb, intensity), extent=[-3, 3, -3, 3])
plt.show()
:
İşte benim kodudur.
Teşekkür