This PR resolves a deprecation warning in euler.py that occurs when running ti example 6. The warning appears as follows:
MatplotlibDeprecationWarning: The get_cmap function was deprecated in Matplotlib 3.7 and will be removed in 3.11. Use matplotlib.colormaps[name] or matplotlib.colormaps.get_cmap() or pyplot.get_cmap() instead.
Changes Made
Updated import statement:
from matplotlib import cm
to
from matplotlib import colormaps
Replaced:
cmap = cm.get_cmap(cmap_name)
with
cmap = colormaps[cmap_name]
Rationale
This change uses the updated API for accessing colormaps in Matplotlib, ensuring compatibility with Matplotlib 3.7+ and removing the deprecation warning.
Testing
Verified that the warning is resolved when running ti example 6 with the updated code.
Confirmed that the colormap functionality remains the same post-update.
Summary
This PR resolves a deprecation warning in
euler.py
that occurs when runningti example 6
. The warning appears as follows:MatplotlibDeprecationWarning: The get_cmap function was deprecated in Matplotlib 3.7 and will be removed in 3.11. Use matplotlib.colormaps[name] or matplotlib.colormaps.get_cmap() or pyplot.get_cmap() instead.
Changes Made
to
with
Rationale
This change uses the updated API for accessing colormaps in Matplotlib, ensuring compatibility with Matplotlib 3.7+ and removing the deprecation warning.
Testing