geone 1.3.0__py313-none-manylinux_2_35_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
geone/customcolors.py ADDED
@@ -0,0 +1,508 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+
4
+ # -------------------------------------------------------------------------
5
+ # Python module: 'customcolors.py'
6
+ # author: Julien Straubhaar
7
+ # date: jan-2018
8
+ # -------------------------------------------------------------------------
9
+
10
+ """
11
+ Module for definition of custom colors and colormaps.
12
+
13
+ **Defined objects in this module**
14
+
15
+ - "default" color for "bad" value (nan)
16
+ - `cbad_def = (.9, .9, .9, 0.5)` : default color for "bad" value (nan)
17
+
18
+ - "default" color map
19
+ - `cmap_def`
20
+
21
+ - some colors from "libreoffice" (merci Christoph!)
22
+ - `col_chart01 = [x/255. for x in ( 0, 69, 134)]` : dark blue
23
+ - `col_chart02 = [x/255. for x in (255, 66, 14)]` : orange
24
+ - `col_chart03 = [x/255. for x in (255, 211, 32)]` : yellow
25
+ - `col_chart04 = [x/255. for x in ( 87, 157, 28)]` : green
26
+ - `col_chart05 = [x/255. for x in (126, 0, 33)]` : dark red
27
+ - `col_chart06 = [x/255. for x in (131, 202, 255)]` : light blue
28
+ - `col_chart07 = [x/255. for x in ( 49, 64, 4)]` : dark green
29
+ - `col_chart08 = [x/255. for x in (174, 207, 0)]` : light green
30
+ - `col_chart09 = [x/255. for x in ( 75, 31, 111)]` : purple
31
+ - `col_chart10 = [x/255. for x in (255, 149, 14)]` : dark yellow
32
+ - `col_chart11 = [x/255. for x in (197, 0, 11)]` : red
33
+ - `col_chart12 = [x/255. for x in ( 0, 132, 209)]` : blue
34
+
35
+ - ... with other names
36
+ - `col_chart_purple = col_chart09`
37
+ - `col_chart_darkblue = col_chart01`
38
+ - `col_chart_blue = col_chart12`
39
+ - `col_chart_lightblue = col_chart06`
40
+ - `col_chart_green = col_chart04`
41
+ - `col_chart_darkgreen = col_chart07`
42
+ - `col_chart_lightgreen = col_chart08`
43
+ - `col_chart_yellow = col_chart03`
44
+ - `col_chart_darkyellow = col_chart10`
45
+ - `col_chart_orange = col_chart02`
46
+ - `col_chart_red = col_chart11`
47
+ - `col_chart_darkred = col_chart05`
48
+
49
+ - ... in list
50
+ - `col_chart_list = [col_chart01, col_chart02, col_chart03, col_chart04, \
51
+ col_chart05, col_chart06, col_chart07, col_chart08, \
52
+ col_chart09, col_chart10, col_chart11, col_chart12]`
53
+ - `col_chart_list_s = [col_chart_list[i] for i in (8, 0, 11, 5, 3, 6, 7, 2, 9, 1, 10, 4)]`
54
+
55
+ - pre-defined colormaps
56
+ - `cmap1`, `cmap2`, `cmapW2B` (white to black), `cmapB2W` (black to white)
57
+ """
58
+
59
+ import numpy as np
60
+ import matplotlib.colors as mcolors
61
+ import matplotlib.pyplot as plt
62
+
63
+ from mpl_toolkits import axes_grid1
64
+
65
+ # ============================================================================
66
+ class CustomcolorsError(Exception):
67
+ """
68
+ Custom exception related to `customcolors` module.
69
+ """
70
+ pass
71
+ # ============================================================================
72
+
73
+ # ----------------------------------------------------------------------------
74
+ def add_colorbar(im, aspect=20.0, pad_fraction=1.0, **kwargs):
75
+ """
76
+ Adds a vertical color bar to an image plot.
77
+
78
+ Parameters
79
+ ----------
80
+ im : matplotlib.image.AxesImage
81
+ image (returned by `matplotlib.pyplot.imshow`)
82
+
83
+ aspect : float, default: 20.0
84
+ aspect ratio height over width of the color bar
85
+
86
+ pad_fraction : float, default: 1.0
87
+ padding fraction with respect to the color bar width; if w is the width
88
+ of the color bar, then the space between the image and the color bar will
89
+ be of with `pad_fraction` * w
90
+
91
+ kwargs : dict
92
+ keyword arguments passed to `im.axes.figure.colorbar`
93
+
94
+ Notes
95
+ -----
96
+ Code from https://nbviewer.jupyter.org/github/mgeier/python-audio/blob/master/plotting/matplotlib-colorbar.ipynb
97
+ """
98
+ # fname = 'add_colorbar'
99
+
100
+ divider = axes_grid1.make_axes_locatable(im.axes)
101
+ width = axes_grid1.axes_size.AxesY(im.axes, aspect=1./aspect)
102
+ pad = axes_grid1.axes_size.Fraction(pad_fraction, width)
103
+ current_ax = plt.gca()
104
+ cax = divider.append_axes("right", size=width, pad=pad)
105
+ plt.sca(current_ax)
106
+ return im.axes.figure.colorbar(im, cax=cax, **kwargs)
107
+ # ----------------------------------------------------------------------------
108
+
109
+ # ----------------------------------------------------------------------------
110
+ def custom_cmap(
111
+ cseq,
112
+ vseq=None,
113
+ ncol=256,
114
+ cunder=None,
115
+ cover=None,
116
+ cbad=None,
117
+ alpha=None,
118
+ cmap_name='custom_cmap',
119
+ logger=None):
120
+ """
121
+ Defines a custom color map given colors at transition values.
122
+
123
+ Parameters
124
+ ----------
125
+ cseq : 1D array-like
126
+ sequence of colors, each color is given by a
127
+ 3-tuple (RGB code), 4-tuple (RGBA code) or string
128
+
129
+ vseq : 1D array-like of floats, optional
130
+ sequence of increasing values of same length as `cseq`, values that
131
+ correspond to the colors given in `cseq` in the output color map;
132
+ by default (`None`): equally spaced values (from 0 to 1) are used
133
+
134
+ ncol : int, default: 256
135
+ number of colors for the color map
136
+
137
+ cunder : object defining a color (e.g. 3-tuple, str), optional
138
+ color (3-tuple (RGB code), 4-tuple (RGBA code) or str), used for
139
+ "under" values
140
+
141
+ cover : object defining a color (e.g. 3-tuple, str), optional
142
+ color (3-tuple (RGB code), 4-tuple (RGBA code) or str), used for
143
+ "over" values
144
+
145
+ cbad : object defining a color (e.g. 3-tuple, str), optional
146
+ color (3-tuple (RGB code), 4-tuple (RGBA code) or str), used for
147
+ "bad" values
148
+
149
+ alpha : 1D array-like of floats, or float, optional
150
+ values of the "alpha" channel (for transparency), for each color in
151
+ `cseq` (if a `alpha` is a float, the same value is used for every color)
152
+
153
+ cmap_name : str, default: 'custom_cmap'
154
+ name of the output color map
155
+
156
+ logger : :class:`logging.Logger`, optional
157
+ logger (see package `logging`)
158
+ if specified, messages are written via `logger` (no print)
159
+
160
+ Returns
161
+ -------
162
+ colormap : `matplotlib.colors.LinearSegmentedColormap`
163
+ color map
164
+
165
+ Examples
166
+ --------
167
+ >>> # # Import if needed
168
+ >>> # import numpy as np
169
+ >>> # import matplotlib.pyplot as plt
170
+ >>> #
171
+ >>> # Set min and max value to be displayed
172
+ >>> vmin, vmax = -1.0, 3.0
173
+ >>> #
174
+ >>> # Create a custom colormap
175
+ >>> # - from blue to white for values from vmin to 0
176
+ >>> # - from white to red for values from 0 to vmax
177
+ >>> # - with specified colors for "under", "over" and "bad" values
178
+ >>> my_cmap = custom_cmap(
179
+ >>> ('blue', 'white', 'red'), vseq=(vmin,0,vmax),
180
+ >>> cunder='cyan', cover='violet', cbad='gray', alpha=1)
181
+ >>> #
182
+ >>> # Array of values to display
183
+ >>> zz = np.linspace(-2, 4, 500).reshape(10, 50)
184
+ >>> zz[:, 20:25] = np.nan
185
+ >>> #
186
+ >>> # Show the array, specifiying min, max and the color map
187
+ >>> im = plt.imshow(zz, vmin=vmin, vmax=vmax, cmap=my_cmap)
188
+ >>> add_colorbar(im, aspect=5., extend='both') # add color bar
189
+ >>> plt.show()
190
+ """
191
+ fname = 'custom_cmap'
192
+
193
+ # Set alpha sequence
194
+ if alpha is None:
195
+ alpha = 1.0
196
+ aseq = np.asarray(alpha, dtype=float) # numpy.ndarray (possibly 0-dimensional)
197
+ if aseq.size == 1:
198
+ aseq = aseq.flat[0] * np.ones(len(cseq))
199
+ elif aseq.size != len(cseq):
200
+ err_msg = f'{fname}: length of `alpha` not compatible with `cseq`'
201
+ if logger: logger.error(err_msg)
202
+ raise CustomcolorsError(err_msg)
203
+
204
+ # Set vseqn: sequence of values rescaled in [0,1]
205
+ if vseq is not None:
206
+ if len(vseq) != len(cseq):
207
+ err_msg = f'{fname}: length of `vseq` and length of `cseq` differ'
208
+ if logger: logger.error(err_msg)
209
+ raise CustomcolorsError(err_msg)
210
+
211
+ if sum(np.diff(vseq) <= 0.0 ):
212
+ err_msg = f'{fname}: `vseq` is not an increasing sequence'
213
+ if logger: logger.error(err_msg)
214
+ raise CustomcolorsError(err_msg)
215
+
216
+ # Linearly rescale vseq on [0,1]
217
+ vseqn = (np.array(vseq,dtype=float) - vseq[0]) / (vseq[-1] - vseq[0])
218
+
219
+ else:
220
+ vseqn = np.linspace(0,1,len(cseq))
221
+
222
+ # Set cseqRGB: sequence of colors as RGB-tuples
223
+ cseqRGB = []
224
+ for c in cseq:
225
+ try:
226
+ cseqRGB.append(mcolors.ColorConverter().to_rgb(c))
227
+ except:
228
+ cseqRGB.append(c)
229
+
230
+ # Set dictionary to define the color map
231
+ cdict = {
232
+ 'red' :[(vseqn[i], cseqRGB[i][0], cseqRGB[i][0]) for i in range(len(cseq))],
233
+ 'green':[(vseqn[i], cseqRGB[i][1], cseqRGB[i][1]) for i in range(len(cseq))],
234
+ 'blue' :[(vseqn[i], cseqRGB[i][2], cseqRGB[i][2]) for i in range(len(cseq))],
235
+ 'alpha':[(vseqn[i], aseq[i], aseq[i]) for i in range(len(cseq))]
236
+ }
237
+
238
+ cmap = mcolors.LinearSegmentedColormap(cmap_name, cdict, N=ncol)
239
+
240
+ if cunder is not None:
241
+ try:
242
+ cmap.set_under(mcolors.ColorConverter().to_rgba(cunder))
243
+ except:
244
+ cmap.set_under(cunder)
245
+
246
+ if cover is not None:
247
+ try:
248
+ cmap.set_over(mcolors.ColorConverter().to_rgba(cover))
249
+ except:
250
+ cmap.set_over(cover)
251
+
252
+ if cbad is not None:
253
+ try:
254
+ cmap.set_bad(mcolors.ColorConverter().to_rgba(cbad))
255
+ except:
256
+ cmap.set_bad(cbad)
257
+
258
+ return cmap
259
+ # ----------------------------------------------------------------------------
260
+
261
+ # Default colormap for function in geone
262
+ # ======================================
263
+ cmap_def = 'viridis'
264
+
265
+ # Some colors and colormaps
266
+ # =========================
267
+
268
+ # Chart color from libreoffice (merci Christoph)
269
+ col_chart01 = [x/255. for x in ( 0, 69, 134)] # dark blue
270
+ col_chart02 = [x/255. for x in (255, 66, 14)] # orange
271
+ col_chart03 = [x/255. for x in (255, 211, 32)] # yellow
272
+ col_chart04 = [x/255. for x in ( 87, 157, 28)] # green
273
+ col_chart05 = [x/255. for x in (126, 0, 33)] # dark red
274
+ col_chart06 = [x/255. for x in (131, 202, 255)] # light blue
275
+ col_chart07 = [x/255. for x in ( 49, 64, 4)] # dark green
276
+ col_chart08 = [x/255. for x in (174, 207, 0)] # light green
277
+ col_chart09 = [x/255. for x in ( 75, 31, 111)] # purple
278
+ col_chart10 = [x/255. for x in (255, 149, 14)] # dark yellow
279
+ col_chart11 = [x/255. for x in (197, 0, 11)] # red
280
+ col_chart12 = [x/255. for x in ( 0, 132, 209)] # blue
281
+
282
+ # ... other names
283
+ col_chart_purple = col_chart09
284
+ col_chart_darkblue = col_chart01
285
+ col_chart_blue = col_chart12
286
+ col_chart_lightblue = col_chart06
287
+ col_chart_green = col_chart04
288
+ col_chart_darkgreen = col_chart07
289
+ col_chart_lightgreen = col_chart08
290
+ col_chart_yellow = col_chart03
291
+ col_chart_darkyellow = col_chart10
292
+ col_chart_orange = col_chart02
293
+ col_chart_red = col_chart11
294
+ col_chart_darkred = col_chart05
295
+
296
+ # ... list
297
+ col_chart_list = [col_chart01, col_chart02, col_chart03, col_chart04,
298
+ col_chart05, col_chart06, col_chart07, col_chart08,
299
+ col_chart09, col_chart10, col_chart11, col_chart12]
300
+
301
+ # ... list reordered
302
+ col_chart_list_s = [col_chart_list[i] for i in (8, 0, 11, 5, 3, 6, 7, 2, 9, 1, 10, 4)]
303
+
304
+ # Default color for bad value (nan)
305
+ cbad_def = (.9, .9, .9, 0.5)
306
+
307
+ # Pre-defined colormaps
308
+ # =====================
309
+
310
+ # colormap cmap1 / cmap1_alpha (increasing alpha values)
311
+ # --------------
312
+ cbad1 = (.9, .9, .9, 0.5)
313
+ # cunder1 = [x/255. for x in (160, 40, 160)] + [0.5] # +[0.5] ... for appending alpha channel
314
+ # cover1 = [x/255. for x in (250, 80, 120)] + [0.5] # +[0.5] ... for appending alpha channel
315
+ cunder1 = [x/255. for x in (200, 10, 250)] + [0.5] # +[0.5] ... for appending alpha channel
316
+ cover1 = [x/255. for x in (250, 10, 10)] + [0.5] # +[0.5] ... for appending alpha channel
317
+ cmaplist1 = ([x/255. for x in (160, 40, 240)],
318
+ [x/255. for x in ( 0, 240, 240)],
319
+ [x/255. for x in (240, 240, 0)],
320
+ [x/255. for x in (180, 10, 10)])
321
+ cmap1 = custom_cmap(cmaplist1, cunder=cunder1, cover=cover1, cbad=cbad1, alpha=1.0)
322
+ cmap1_alpha = custom_cmap(cmaplist1, alpha=np.linspace(0, 1, len(cmaplist1)), cunder=cunder1, cover=cover1, cbad=cbad1)
323
+
324
+ # colormap cmap2 / cmap2_alpha (increasing alpha values)
325
+ # --------------
326
+ cmaplist2 = ['purple', 'blue', 'cyan', 'yellow', 'red', 'black']
327
+ cbad2 = cbad_def
328
+ cunder2 = cbad_def
329
+ cover2 = cbad_def
330
+ cmap2 = custom_cmap(cmaplist2, cunder=cunder2, cover=cover2, cbad=cbad2, alpha=1.0)
331
+ cmap2_alpha = custom_cmap(cmaplist2, alpha=np.linspace(0, 2, len(cmaplist2)), cunder=cunder2, cover=cover2, cbad=cbad2)
332
+
333
+ # colormap cmapW2B / cmapB2W (white to black / black to white)
334
+ # --------------
335
+ cmapW2B = custom_cmap(['white', 'black'], cunder=(0.0, 0.0, 1.0, 0.5), cover=(1.0, 0.0, 0.0, 0.5), cbad=col_chart_yellow+[0.5], alpha=1.0)
336
+ cmapB2W = custom_cmap(['black', 'white'], cunder=(0.0, 0.0, 1.0, 0.5), cover=(1.0, 0.0, 0.0, 0.5), cbad=col_chart_yellow+[0.5], alpha=1.0)
337
+
338
+ # "Extended" existing colormap from matplotlib, by adding specific colors for under values, over values and bad values
339
+ # # Example for cmap 'terrain'
340
+ # cmap_terrain_ext = custom_cmap([plt.get_cmap('terrain')(x) for x in np.linspace(0, 1, 256)], ncol=256, cunder='pink', cover='orange', cbad='red')
341
+ # # or:
342
+ # cmap_terrain_ext = plt.get_cmap('terrain')
343
+ # cmap_terrain_ext.set_under('pink')
344
+ # cmap_terrain_ext.set_over('orange')
345
+ # cmap_terrain_ext.set_bad('red')
346
+ # ----------------------------------------------------------------------------
347
+ #
348
+ # # Notes:
349
+ # # =====
350
+ # # To show available colormaps in matplotlib:
351
+ # plt.colormaps()
352
+ #
353
+ # # To show some colormaps (LinearSegmentedColormap) from matplotlib:
354
+ # cm_name = [name for name in plt.cm.datad.keys()]
355
+ # cmap = plt.get_cmap('ocean') # get the colormap named 'ocean' (cm_name[105])
356
+ #
357
+ # # To get current rcParams (matplotlib)
358
+ # import matplotlib
359
+ # matplotlib.rcParams
360
+ #
361
+ # # Useful function to convert color from/to rgb[a]/hex:
362
+ # import matplotlib
363
+ # matplotlib.mcolors.to_rgb()
364
+ # matplotlib.mcolors.to_rgba()
365
+ # matplotlib.mcolors.to_hex()
366
+ # matplotlib.mcolors.to_hex(,keep_alpha=True)
367
+ # ----------------------------------------------------------------------------
368
+
369
+ if __name__ == "__main__":
370
+ print("Module 'geone.customcolors' example:")
371
+ import matplotlib.pyplot as plt
372
+
373
+ # Plot a function of two variable in a given domain
374
+ # Set domain and number of cell in each direction
375
+ xmin, xmax = -2, 2
376
+ ymin, ymax = -1, 2
377
+ nx, ny = 200, 150
378
+
379
+ # Set the cell size
380
+ sx, sy = (xmax-xmin)/nx, (ymax-ymin)/ny
381
+
382
+ # Set the meshgrid
383
+ x, y = xmin + 0.5 * sx + sx * np.arange(nx), ymin + 0.5 * sy + sy * np.arange(ny)
384
+ # # equivalently:
385
+ # x, y = np.arange(xmin+sx/2, xmax, sx), np.arange(ymin+sy/2, ymax ,sy)
386
+ # x, y = np.linspace(xmin+sx/2, xmax-sx/2, nx), np.linspace(ymin+sy/2, ymax-sy/2, ny)
387
+ xx,yy = np.meshgrid(x,y)
388
+
389
+ # Set the function values
390
+ zz = xx**2 + yy**2 - 2
391
+ zz[np.where(zz < -1.7)] = np.nan
392
+
393
+ # Specify some points in the grid
394
+ px = np.arange(xmin,xmax,.1)
395
+ py = np.zeros(len(px))
396
+ pz = px**2 + py**2 - 2
397
+ pz[np.where(pz < -1.7)] = np.nan
398
+
399
+ # Set min and max value to be displayed
400
+ vmin, vmax = -1.0, 3.0
401
+
402
+ # Create a custom colormap
403
+ my_cmap = custom_cmap(('blue', 'white', 'red'), vseq=(vmin,0,vmax),
404
+ cunder='cyan', cover='violet', cbad='gray', alpha=.3)
405
+
406
+ # Display
407
+ fig, ax = plt.subplots(2,2,figsize=(16,10))
408
+ # --- 1st plot ---
409
+ cax = ax[0,0]
410
+ im_plot = cax.imshow(zz, cmap=cmap1, vmin=vmin, vmax=vmax, origin='lower',
411
+ extent=[xmin, xmax, ymin, ymax], interpolation='none')
412
+ cax.set_xlim(xmin, xmax)
413
+ cax.set_ylim(ymin, ymax)
414
+ cax.grid()
415
+ cax.set_xlabel("x-axis")
416
+ cax.set_xticks([-1, 1])
417
+ cax.set_xticklabels(['x=-1', 'x=1'], fontsize=8)
418
+
419
+ # cbarShrink = 0.9
420
+ # plt.colorbar(extend='both', shrink=cbarShrink, aspect=20*cbarShrink)
421
+ add_colorbar(im_plot, extend='both')
422
+
423
+ # add points
424
+ col = [0 for i in range(len(pz))]
425
+ for i in range(len(pz)):
426
+ if ~ np.isnan(pz[i]):
427
+ col[i] = cmap1((pz[i]-vmin)/(vmax-vmin))
428
+ else:
429
+ col[i] = mcolors.ColorConverter().to_rgba(cbad1)
430
+
431
+ cax.scatter(px, py, marker='o', s=50, edgecolor='black', color=col)
432
+ cax.set_title('colormap: cmap1')
433
+
434
+ # --- 2nd plot ---
435
+ plt.subplot(2,2,2)
436
+ im_plot = plt.imshow(zz,cmap=my_cmap, vmin=vmin, vmax=vmax, origin='lower',
437
+ extent=[xmin, xmax, ymin, ymax], interpolation='none')
438
+ plt.grid()
439
+
440
+ cbar = add_colorbar(im_plot, ticks=[vmin,vmax])
441
+ # cbar.ax.set_yticklabels(cbar.get_ticks(), fontsize=16)
442
+ cbar.set_ticks([vmin, 0, vmax])
443
+ cbar.ax.set_yticklabels([f'min={vmin}', 0, f'max={vmax}'], fontsize=16)
444
+
445
+ col = [0 for i in range(len(pz))]
446
+ for i in range(len(pz)):
447
+ if not np.isnan(pz[i]):
448
+ col[i] = my_cmap((pz[i]-vmin)/(vmax-vmin))
449
+ else:
450
+ col[i] = mcolors.ColorConverter().to_rgba('gray')
451
+
452
+ # add points
453
+ plt.scatter(px, py, marker='o', s=50, edgecolor='black', color=col)
454
+
455
+ plt.title('colormap: my_cmap')
456
+
457
+ # --- 3rd plot ---
458
+ plt.subplot(2,2,3)
459
+ im_plot = plt.imshow(zz, cmap=custom_cmap(col_chart_list, ncol=len(col_chart_list)),
460
+ vmin=vmin, vmax=vmax, origin='lower',
461
+ extent=[xmin,xmax,ymin,ymax], interpolation='none')
462
+ plt.grid()
463
+ # plt.colorbar(shrink=cbarShrink, aspect=20*cbarShrink)
464
+ add_colorbar(im_plot)
465
+
466
+ #col = custom_cmap(col_chart_list, ncol=len(col_chart_list))((pz-vmin)/(vmax-vmin))
467
+ col = [0 for i in range(len(pz))]
468
+ for i in range(len(pz)):
469
+ if ~ np.isnan(pz[i]):
470
+ col[i] = custom_cmap(col_chart_list, ncol=len(col_chart_list))((pz[i]-vmin)/(vmax-vmin))
471
+ else:
472
+ col[i] = mcolors.ColorConverter().to_rgba('white')
473
+
474
+ plt.scatter(px, py, marker='o', s=50, edgecolor='black', color=col)
475
+
476
+ plt.title('colormap: col_chart_list')
477
+
478
+ # --- 4th plot ---
479
+ plt.subplot(2,2,4)
480
+ im_plot = plt.imshow(zz, cmap=custom_cmap(col_chart_list_s,
481
+ ncol=len(col_chart_list_s)),
482
+ vmin=vmin, vmax=vmax, origin='lower',
483
+ extent=[xmin, xmax, ymin, ymax], interpolation='none')
484
+ plt.grid()
485
+ # plt.colorbar(shrink=cbarShrink, aspect=20*cbarShrink)
486
+ add_colorbar(im_plot)
487
+
488
+ #col = custom_cmap(col_chart_list_s, ncol=len(col_chart_list_s))((pz-vmin)/(vmax-vmin))
489
+ col = [0 for i in range(len(pz))]
490
+ for i in range(len(pz)):
491
+ if ~ np.isnan(pz[i]):
492
+ col[i] = custom_cmap(col_chart_list_s, ncol=len(col_chart_list_s))((pz[i]-vmin)/(vmax-vmin))
493
+ else:
494
+ col[i] = mcolors.ColorConverter().to_rgba('white')
495
+
496
+ plt.scatter(px, py, marker='o', s=50, edgecolor='black', color=col)
497
+
498
+ plt.title('colormap: col_chart_list_s')
499
+
500
+ # main title
501
+ plt.suptitle(r'$z=x^2 + y^2 - 2$', fontsize=24)
502
+
503
+ # plt.tight_layout()
504
+
505
+ # fig.show()
506
+ plt.show()
507
+
508
+ a = input("Press enter to continue...")
@@ -0,0 +1,5 @@
1
+ # import all modules...
2
+ try:
3
+ import geone.deesse_core.deesse
4
+ except ImportError:
5
+ pass
Binary file