Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Right-click on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: Tune Kamae <kamae@sl...> - 2004-12-05 04:27:07
|
Dear PLplot experts, I have been using PLplot through python/numarray to plot astronomical intensity maps in false color for 2 years. Ever since I wrote the first shaded contour plot, I have been wishing to improve the contrasts and the dynamic range of the Hue mapping. I came up with an inproved mapping using RGB (can also be in HSV) by making the function non0linear. This requires many reference points (eg. 20 points). Following the manual description on plshades and the python example xw11.py, I wrote the following cmap1_init_3D. But it doesn't work. I would appreciate any guidance or suggestion. T. Kamae, Stanford Linear Accelerator Center. ---------------------------------------------------------------------------- # Color map 1 in RGB space for plot3D # (from plplot/examples/python/xw11.py) def cmap1_init_3D(self, gray): """Routine for defining a specific color map 1 in RGB space. If gray is true, use basic grayscale variation from half-dark to light. Otherwise use a parameteized mapping to R(z), G(z), and B(z) where z=[0,1]. i=0 corresponds to z=1.0, the brightest color for this implementation. """ # Independent variable of control points. i = arange(0.0, 1.05, 0.05) if gray: # Red for control points. r = arange(241.0, 0.0, -12.0) # Green for control points. g = arange(241.0, 0.0, -12.0) # Blue for control points. b = arange(241.0, 0.0, -12.0) else: z=arange(1.0,1.05,0.05) z[20]=1.0 # Red for control points. r = 113.9*sin(7.64*z**1.705+0.701)-916.1*(z+1.755)**1.862\ +3587.9*z+2563.4 rr = clip(r,0.0,255.0) # Green for control points. g = 70.0*sin(8.7*z**1.26-2.418)+151.7*z**0.5+70.0 gg = clip(g,0.0,255.0) # Blue for control points. b = 194.5*z**2.88+99.72*exp(-77.24*(z-0.742)**2)\ +45.40*z**0.089+10.0 bb = clip(b,0.0,255.0) # Integer flag array is zero (no interpolation along far-side # of colour figure.) rev = array([0]+[1]*19+[0]) # number of cmap1 colours is 256 in this case. # smaller the number of colours, the clearer the z contour #plscmap1n(256) plscmap1n(21) # Interpolate between control points to set up cmap1. plscmap1l(1, i, rr, gg, bb, rev) |