Skip to content

Commit 7376805

Browse files
committed
improvements to everything
1 parent a868b5e commit 7376805

File tree

4 files changed

+43
-15
lines changed

4 files changed

+43
-15
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@ dist
66
*.npy
77
figures/eval*
88
figures/gallery*
9-
figures/lightness*
9+
.pytest_cache/*
10+
docs/build/*
11+
figures/lightness*

cmocean/plots.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def plot_gallery(saveplot=False):
7474
gradient = np.vstack((gradient, gradient))
7575
x = np.linspace(0.0, 1.0, 256)
7676

77-
fig, axes = plt.subplots(nrows=len(cm.cmap_d)/2, ncols=1, figsize=(6, 12))
77+
fig, axes = plt.subplots(nrows=int(len(cm.cmap_d)/2), ncols=1, figsize=(6, 12))
7878
fig.subplots_adjust(top=0.99, bottom=0.01, left=0.2, right=0.99, wspace=0.05)
7979

8080
for ax, cmapname in zip(axes, cm.cmapnames):

docs/source/colormaps_viscm.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
import cmocean
1010

11-
cmaps = cmocean.cm.cmall
1211

13-
for cmap in cmaps:
14-
cmocean.plots.wrap_viscm(cmap)
12+
for cmapname in cmocean.cm.cmapnames:
13+
cmocean.plots.wrap_viscm(cmocean.cm.cmap_d[cmapname], saveplot=False)

docs/source/index.rst

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Here are some properties from the *haline* colormap. We can see that the colorma
4242
:include-source:
4343

4444
import cmocean
45-
cmocean.plots.wrap_viscm(cmocean.cm.haline)
45+
cmocean.plots.wrap_viscm(cmocean.cm.haline, saveplot=False)
4646

4747

4848
All of the evaluations of the colormaps using the viscm tool are shown in the page :ref:`colormaps_viscm`.
@@ -57,7 +57,6 @@ The *thermal* colormap is sequential with dark blue representing lower, cooler v
5757

5858
.. figure:: http://gcoos2.tamu.edu/gandalf_data/deployments/tamu/unit_540/plots/sci_water_temp.png
5959
:target: http://gcoos2.tamu.edu/gandalf_data/deployments/tamu/unit_540/plots/
60-
:scale: 100 %
6160

6261
.. figure:: http://gcoos2.tamu.edu/gandalf_data/deployments/tamu/unit_541/plots/sci_water_temp.png
6362
:target: http://gcoos2.tamu.edu/gandalf_data/deployments/tamu/unit_541/plots/
@@ -118,25 +117,21 @@ The *haline* colormap is sequential, and might be used with dark blue representi
118117

119118
.. figure:: http://gcoos2.tamu.edu/gandalf_data/deployments/tamu/unit_540/plots/calc_salinity.png
120119
:target: http://gcoos2.tamu.edu/gandalf_data/deployments/tamu/unit_540/plots/
121-
:scale: 100 %
122120

123121
.. figure:: http://gcoos2.tamu.edu/gandalf_data/deployments/tamu/unit_541/plots/calc_salinity.png
124122
:target: http://gcoos2.tamu.edu/gandalf_data/deployments/tamu/unit_541/plots/
125-
:scale: 100 %
126123

127124
Glider data from Texas A&M's Geochemical and Environmental Research Group (GERG).
128125

129126

130127
.. figure:: http://pong.tamu.edu/~kthyng/movies/txla_plots/salt/2010-07-30T00.png
131128
:target: http://kristenthyng.com/gallery/txla_salinity.html
132-
:scale: 100 %
133129

134130
Model output in the northwest Gulf of Mexico from the Physical Oceanography Numerical Group (PONG) at Texas A&M.
135131

136132

137133
.. figure:: http://clarkrichards.org/figure/source/2016-04-25-making-section-plots/plot2-1.png
138134
:target: http://clarkrichards.org/r/oce/section/ctd/2016/04/25/making-section-plots/
139-
:scale: 100 %
140135

141136
Plotting CTD data (temperature and salinity) with the R `oce` package, by `Clark Richards <http://clarkrichards.org/r/oce/section/ctd/2016/04/25/making-section-plots/>`_
142137

@@ -257,7 +252,7 @@ The *algae* colormap is sequential with whitish-green for low values and increas
257252
:target: http://gcoos2.tamu.edu/gandalf_data/deployments/tamu/unit_541/plots/sci_flbbcd_chlor_units.png
258253

259254

260-
.. image:: https://rbr-global.com/wp-content/uploads/2016/09/WireWalker_data_wide_zoom.png
255+
.. figure:: https://rbr-global.com/wp-content/uploads/2016/09/WireWalker_data_wide_zoom.png
261256
:target: https://rbr-global.com/products/systems/wirewalker
262257

263258
Example data from RBR's Del Mar Oceanographic (DMO) Wirewalker, a wave-powered profiling system.
@@ -379,7 +374,6 @@ The *curl* colormap is diverging from darker teal to just off-white through shad
379374

380375
Julia Set fractal in `plotly <https://plot.ly/>`_
381376

382-
383377
Capabilities
384378
------------
385379

@@ -447,6 +441,40 @@ Reversed versions of all colormaps are available by appending "_r" to the colorm
447441
fig.tight_layout()
448442

449443

444+
You can lighten a colormap using an alpha value below 1 with the `cmocean.tools.lighten()` function so that you can overlay contours and other lines that are more easily visible:
445+
446+
.. plot::
447+
:include-source:
448+
449+
import cmocean
450+
import cmocean.cm as cmo
451+
import matplotlib.pyplot as plt
452+
453+
fig = plt.figure(figsize=(8, 3))
454+
ax = fig.add_subplot(1, 2, 1)
455+
Z = np.random.randn(10,10)
456+
ax.pcolormesh(Z, cmap=cmo.matter)
457+
458+
ax = fig.add_subplot(1, 2, 2)
459+
lightcmap = cmocean.tools.lighten(cmo.matter, 0.5)
460+
ax.pcolormesh(Z, cmap=lightcmap)
461+
fig.tight_layout()
462+
463+
464+
`cmocean` will register its colormaps with `matplotlib` so you can call them with, for example, 'cmo.amp':
465+
466+
.. plot::
467+
:include-source:
468+
469+
import cmocean
470+
import matplotlib.pyplot as plt
471+
472+
fig = plt.figure(figsize=(4, 3))
473+
ax = fig.add_subplot(111)
474+
Z = np.random.randn(10,10)
475+
ax.pcolormesh(Z, cmap='cmo.amp')
476+
477+
450478
Resources
451479
---------
452480

@@ -470,8 +498,7 @@ cmocean available elsewhere!
470498
* `julia <http://docs.juliaplots.org/latest/colors/>`_
471499
* Spatial Temporal Oceanographic Query System `(STOQS) <http://www.stoqs.org/>`_ is a geospatial database software package designed for providing efficient access to in situ oceanographic measurement data.
472500
* cmocean colormaps are used in the following publications:
473-
* Kenel, C., Grolimund, D., Li, X., Panepucci, E., Samson, V. A., Sanchez, D. F., ... & Leinenbach, C. (2017). In situ investigation of phase transformations in Ti-6Al-4V under additive manufacturing conditions combining laser melting and high-speed micro-X-ray diffraction. Scientific reports, 7(1), 16358.
474-
`<https://www.nature.com/articles/s41598-017-16760-0>`_
501+
* Kenel, C., Grolimund, D., Li, X., Panepucci, E., Samson, V. A., Sanchez, D. F., ... & Leinenbach, C. (2017). In situ investigation of phase transformations in Ti-6Al-4V under additive manufacturing conditions combining laser melting and high-speed micro-X-ray diffraction. Scientific reports, 7(1), 16358. `<https://www.nature.com/articles/s41598-017-16760-0>`_
475502
* Usamentiaga, R., Ibarra-Castanedo, C., Klein, M., Maldague, X., Peeters, J., & Sanchez-Beato, A. (2017). Nondestructive evaluation of carbon fiber bicycle frames using infrared thermography. Sensors, 17(11), 2679. `<http://www.mdpi.com/1424-8220/17/11/2679/htm>`_
476503
* WUNSCH, C. (2018). Towards determining uncertainties in global oceanic mean values of heat, salt, and surface elevation. Tellus A: Dynamic Meteorology and Oceanography, 70(1), 1-14. `<https://www.tandfonline.com/doi/full/10.1080/16000870.2018.1471911>`_
477504

0 commit comments

Comments
 (0)