From: <js...@us...> - 2009-03-16 19:32:33
|
Revision: 6982 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6982&view=rev Author: jswhit Date: 2009-03-16 19:32:22 +0000 (Mon, 16 Mar 2009) Log Message: ----------- fix small bug in relief plot shading algorithm Modified Paths: -------------- trunk/matplotlib/examples/pylab_examples/shading_example.py trunk/matplotlib/lib/matplotlib/colors.py Modified: trunk/matplotlib/examples/pylab_examples/shading_example.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/shading_example.py 2009-03-16 17:22:07 UTC (rev 6981) +++ trunk/matplotlib/examples/pylab_examples/shading_example.py 2009-03-16 19:32:22 UTC (rev 6982) @@ -9,10 +9,10 @@ # (http://gmt.soest.hawaii.edu/gmt/doc/gmt/html/GMT_Docs/node145.html) # test data -X,Y=np.mgrid[-5:5:0.1,-5:5:0.1] -Z=X+np.sin(X**2+Y**2) +X,Y=np.mgrid[-5:5:0.05,-5:5:0.05] +Z=np.sqrt(X**2+Y**2)+np.sin(X**2+Y**2) # creat light source object. -ls = lightsource(azdeg=270,altdeg=60) +ls = lightsource(azdeg=0,altdeg=65) # shade data, creating an rgb array. rgb = ls.shade(Z,plt.cm.copper) # plot un-shaded and shaded images. Modified: trunk/matplotlib/lib/matplotlib/colors.py =================================================================== --- trunk/matplotlib/lib/matplotlib/colors.py 2009-03-16 17:22:07 UTC (rev 6981) +++ trunk/matplotlib/lib/matplotlib/colors.py 2009-03-16 19:32:22 UTC (rev 6982) @@ -1018,11 +1018,11 @@ # modify hsv values to simulate illumination. hsv[:,:,1] = np.where(np.logical_and(np.abs(hsv[:,:,1])>1.e-10,intensity>0),\ (1.-intensity)*hsv[:,:,1]+intensity*self.hsv_max_sat, hsv[:,:,1]) - hsv[:,:,2] = np.where(intensity > 0, (1.-intensity)*hsv[:,:,1] +\ + hsv[:,:,2] = np.where(intensity > 0, (1.-intensity)*hsv[:,:,2] +\ intensity*self.hsv_max_val, hsv[:,:,2]) hsv[:,:,1] = np.where(np.logical_and(np.abs(hsv[:,:,1])>1.e-10,intensity<0),\ (1.+intensity)*hsv[:,:,1]-intensity*self.hsv_min_sat, hsv[:,:,1]) - hsv[:,:,2] = np.where(intensity < 0, (1.+intensity)*hsv[:,:,1] -\ + hsv[:,:,2] = np.where(intensity < 0, (1.+intensity)*hsv[:,:,2] -\ intensity*self.hsv_min_val, hsv[:,:,2]) hsv[:,:,1:] = np.where(hsv[:,:,1:]<0.,0,hsv[:,:,1:]) hsv[:,:,1:] = np.where(hsv[:,:,1:]>1.,1,hsv[:,:,1:]) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |