|
3 | 3 | from matplotlib.colors import LightSource
|
4 | 4 | from matplotlib import cbook
|
5 | 5 |
|
6 |
| -# Example showing how to make shaded relief plots |
| 6 | +# Example showing how to make shaded relief plots |
7 | 7 | # like Mathematica
|
8 | 8 | # (http://reference.wolfram.com/mathematica/ref/ReliefPlot.html)
|
9 | 9 | # or Generic Mapping Tools
|
@@ -31,17 +31,19 @@ def compare(z, cmap, ve=1):
|
31 | 31 | # Illuminate the scene from the northwest
|
32 | 32 | ls = LightSource(azdeg=315, altdeg=45)
|
33 | 33 |
|
34 |
| - axes[0,0].imshow(z, cmap=cmap) |
35 |
| - axes[0,0].set(xlabel='Colormapped Data') |
| 34 | + axes[0, 0].imshow(z, cmap=cmap) |
| 35 | + axes[0, 0].set(xlabel='Colormapped Data') |
36 | 36 |
|
37 |
| - axes[0,1].imshow(ls.hillshade(z, vert_exag=ve), cmap='gray') |
38 |
| - axes[0,1].set(xlabel='Illumination Intensity') |
| 37 | + axes[0, 1].imshow(ls.hillshade(z, vert_exag=ve), cmap='gray') |
| 38 | + axes[0, 1].set(xlabel='Illumination Intensity') |
39 | 39 |
|
40 |
| - axes[1,0].imshow(ls.shade(z, cmap=cmap, vert_exag=ve, blend_mode='hsv')) |
41 |
| - axes[1,0].set(xlabel='Blend Mode: "hsv" (default)') |
| 40 | + rgb = ls.shade(z, cmap=cmap, vert_exag=ve, blend_mode='hsv') |
| 41 | + axes[1, 0].imshow(rgb) |
| 42 | + axes[1, 0].set(xlabel='Blend Mode: "hsv" (default)') |
42 | 43 |
|
43 |
| - axes[1,1].imshow(ls.shade(z, cmap=cmap, vert_exag=ve, blend_mode='overlay')) |
44 |
| - axes[1,1].set(xlabel='Blend Mode: "overlay"') |
| 44 | + rgb = ls.shade(z, cmap=cmap, vert_exag=ve, blend_mode='overlay') |
| 45 | + axes[1, 1].imshow(rgb) |
| 46 | + axes[1, 1].set(xlabel='Blend Mode: "overlay"') |
45 | 47 |
|
46 | 48 | return fig
|
47 | 49 |
|
|
0 commit comments