Note
Go to the end to download the full example code
Using the sunpy Colormaps with matplotlib#
How you can use the sunpy colormaps with matplotlib.
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import sunpy.visualization.colormaps as cm
When the sunpy colormaps are imported, the sunpy colormaps are registered with matplotlib. It is now possible to access the colormaps with the following command.
sdoaia171 = matplotlib.colormaps['sdoaia171']
You can get the list of all sunpy colormaps with:
print(cm.cmlist.keys())
dict_keys(['goes-rsuvi94', 'goes-rsuvi131', 'goes-rsuvi171', 'goes-rsuvi195', 'goes-rsuvi284', 'goes-rsuvi304', 'sdoaia94', 'sdoaia131', 'sdoaia171', 'sdoaia193', 'sdoaia211', 'sdoaia304', 'sdoaia335', 'sdoaia1600', 'sdoaia1700', 'sdoaia4500', 'sohoeit171', 'sohoeit195', 'sohoeit284', 'sohoeit304', 'soholasco2', 'soholasco3', 'sswidlsoholasco2', 'sswidlsoholasco3', 'stereocor1', 'stereocor2', 'stereohi1', 'stereohi2', 'yohkohsxtal', 'yohkohsxtwh', 'hinodexrt', 'hinodesotintensity', 'trace171', 'trace195', 'trace284', 'trace1216', 'trace1550', 'trace1600', 'trace1700', 'traceWL', 'hmimag', 'irissji1330', 'irissji1400', 'irissji1600', 'irissji2796', 'irissji2832', 'irissji5000', 'irissjiFUV', 'irissjiNUV', 'irissjiSJI_NUV', 'kcor', 'rhessi', 'std_gamma_2', 'euvi171', 'euvi195', 'euvi284', 'euvi304', 'solar orbiterfsi174', 'solar orbiterfsi304', 'solar orbiterhri_euv174', 'solar orbiterhri_lya1216'])
Let’s now create a data array.
Let’s now plot the results with the colormap.

Total running time of the script: (0 minutes 0.118 seconds)