|
8 | 8 | from . import util as _util |
9 | 9 |
|
10 | 10 |
|
11 | | -def _register_cmap_clip(name, original_name, alpha): |
| 11 | +def _register_cmap_clip(name, original_name, col_alpha_u, col_apha_o): |
12 | 12 | """Create a color map with "over" and "under" values.""" |
13 | 13 | cmap = _plt.get_cmap(original_name) |
14 | 14 | cmap = cmap.with_extremes( |
15 | | - under=cmap.get_under() * [1, 1, 1, alpha], |
16 | | - over=cmap.get_over() * [1, 1, 1, alpha]) |
| 15 | + under=cmap.get_under() * col_alpha_u, |
| 16 | + over=cmap.get_over() * col_apha_o) |
17 | 17 | cmap.name = name |
18 | 18 | _plt.colormaps.register(cmap=cmap) |
19 | 19 |
|
20 | 20 |
|
21 | | -_register_cmap_clip('cividis_clip', 'cividis', 0.6) |
22 | | -_register_cmap_clip('cividis_r_clip', 'cividis_r', 0.6) |
23 | | -_register_cmap_clip('viridis_clip', 'viridis', 0.6) |
24 | | -_register_cmap_clip('viridis_r_clip', 'viridis_r', 0.6) |
| 21 | +_register_cmap_clip('cividis_clip', 'cividis', |
| 22 | + [1, 1, 1, 0.6],[1, 1, 1, 0.1]) |
| 23 | +_register_cmap_clip('cividis_r_clip', 'cividis_r', |
| 24 | + [1, 1, 1, 0.1], [1, 1, 1, 0.6]) |
| 25 | +_register_cmap_clip('viridis_clip', 'viridis', |
| 26 | + [1, 1, 1, 0.6], [1, 1, 1, 0.1]) |
| 27 | +_register_cmap_clip('viridis_r_clip', 'viridis_r', |
| 28 | + [1, 1, 1, 0.1], [1, 1, 1, 0.6]) |
25 | 29 |
|
26 | 30 | # The 'coolwarm' colormap is based on the paper |
27 | 31 | # "Diverging Color Maps for Scientific Visualization" by Kenneth Moreland |
28 | | -# http://www.sandia.gov/~kmorel/documents/ColorMaps/ |
29 | | -_register_cmap_clip('coolwarm_clip', 'coolwarm', 0.6) |
30 | | -_register_cmap_clip('coolwarm_r_clip', 'coolwarm_r', 0.6) |
| 32 | +# https://www.kennethmoreland.com/color-maps/ColorMapsExpanded.pdf |
| 33 | +_register_cmap_clip('coolwarm_clip', 'coolwarm', |
| 34 | + [1, 1, 1, 0.5], [1, 1, 1, 0.5]) |
| 35 | +_register_cmap_clip('coolwarm_r_clip', 'coolwarm_r', |
| 36 | + [1, 1, 1, 0.5], [1, 1, 1, 0.5]) |
31 | 37 |
|
32 | 38 |
|
33 | 39 | def _register_cmap_transparent(name, color): |
@@ -176,7 +182,7 @@ def _visible_secondarysources(x0, n0, grid): |
176 | 182 | """Determine secondary sources which lie within *grid*.""" |
177 | 183 | x, y = _util.as_xyz_components(grid[:2]) |
178 | 184 | idx = _np.where((x0[:, 0] > x.min()) & (x0[:, 0] < x.max()) & |
179 | | - (x0[:, 1] > y.min()) & (x0[:, 1] < x.max())) |
| 185 | + (x0[:, 1] > y.min()) & (x0[:, 1] < x.max())) |
180 | 186 | idx = _np.squeeze(idx) |
181 | 187 |
|
182 | 188 | return x0[idx, :], n0[idx, :] |
|
0 commit comments