taichi-dev / taichi

Productive, portable, and performant GPU programming in Python.
https://taichi-lang.org
Apache License 2.0
25.56k stars 2.29k forks source link

[Example] Update colormap access in euler.py to prevent MatplotlibDeprecationWarning #8596

Open bluevisor opened 2 weeks ago

bluevisor commented 2 weeks ago

Summary

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

Rationale

This change uses the updated API for accessing colormaps in Matplotlib, ensuring compatibility with Matplotlib 3.7+ and removing the deprecation warning.

Testing

CLAassistant commented 2 weeks ago

CLA assistant check
All committers have signed the CLA.