@image_comparison(baseline_images=[u'light_source_shading_topo'], extensions=[u'png'])
def test_light_source_topo_surface():
 fname = cbook.get_sample_data(u'jacksboro_fault_dem.npz', asfileobj=False)
 dem = np.load(fname)
 elev = dem[u'elevation']
 (dx, dy) = (dem[u'dx'], dem[u'dy'])
 dx = ((111320.0 * dx) * np.cos(dem[u'ymin']))
 dy = (111320.0 * dy)
 dem.close()
 ls = mcolors.LightSource(315, 45)
 cmap = cm.gist_earth
 (fig, axes) = plt.subplots(nrows=3, ncols=3)
 for (row, mode) in zip(axes, [u'hsv', u'overlay', u'soft']):
  for (ax, ve) in zip(row, [0.1, 1, 10]):
   rgb = ls.shade(elev, cmap, vert_exag=ve, dx=dx, dy=dy, blend_mode=mode)
   ax.imshow(rgb)
   ax.set(xticks=[], yticks=[])

@ image_comparison ( baseline_images = [ u'light_source_shading_topo' ] , extensions = [ u'png' ] ) def test_light_source_topo_surface ( ) : fname = cbook . get_sample_data ( u'jacksboro_fault_dem.npz' , asfileobj = False ) dem = np . load ( fname ) elev = dem [ u'elevation' ] ( dx , dy ) = ( dem [ u'dx' ] , dem [ u'dy' ] ) dx = ( ( 111320.0 * dx ) * np . cos ( dem [ u'ymin' ] ) ) dy = ( 111320.0 * dy ) dem . close ( ) ls = mcolors . LightSource ( 315 , 45 ) cmap = cm . gist_earth ( fig , axes ) = plt . subplots ( nrows = 3 , ncols = 3 ) for ( row , mode ) in zip ( axes , [ u'hsv' , u'overlay' , u'soft' ] ) : for ( ax , ve ) in zip ( row , [ 0.1 , 1 , 10 ] ) : rgb = ls . shade ( elev , cmap , vert_exag = ve , dx = dx , dy = dy , blend_mode = mode ) ax . imshow ( rgb ) ax . set ( xticks = [ ] , yticks = [ ] )
shades a dem using different v .