ChristopherMayes / openPMD-beamphysics

Tools for analyzing and viewing particle data in the openPMD standard, extension beamphysics.
https://christophermayes.github.io/openPMD-beamphysics/
Apache License 2.0
16 stars 15 forks source link

matplotlib cmap warning/ depreciation #12

Closed nneveu closed 3 years ago

nneveu commented 3 years ago

I'm getting a matplotlib/colarmap warning when loading openPMD-beamphysics in plot.py file. Looks like this behavior may not be allowed in the future.

/Users/nneveu/Code/anaconda3/envs/lume/lib/python3.7/site-packages/pmd_beamphysics/plot.py:13: MatplotlibDeprecationWarning: You are modifying the state of a globally registered colormap. In future versions, you will not be able to modify a registered colormap in-place. To remove this warning, you can make a copy of the colormap first. cmap = copy.copy(mpl.cm.get_cmap("viridis")) cmap.set_under('white')

ChristopherMayes commented 3 years ago

@nneveu The latest code already does this: https://github.com/ChristopherMayes/openPMD-beamphysics/blob/c03c5cda7e8597af5b8781ecce1e360117b06dfb/pmd_beamphysics/plot.py#L13

Are you sure you have the latest version?