Matplotlib deprecation warning
評估
- 難度
- 1/5
- 預估耗時
- 1 小時以內
- 新手友好度
- 88/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- matplotlib, python
研究方向
過時的呼叫位於 cmocean/cm.py 中,那裡以 N 參數實例化了 colors.ListedColormap。要重現問題,請執行 issue 中的程式片段,並觀察匯入時出現的 MatplotlibDeprecationWarning。當從這些實例化中移除 N 參數,且匯入 cmocean 時不再發出任何棄用警告,即為完成。
由索引模型根據 Issue 內容生成。
描述
Error description
Importing cmocean gives a Matplotlib deprecation warning. MWE to reproduce the issue:
import warnings
import matplotlib
# Import the specific warning class from matplotlib
from matplotlib import MatplotlibDeprecationWarning
print(f"Testing environment with Matplotlib version: {matplotlib.__version__}")
# Force this specific warning to always print for testing purposes
warnings.simplefilter('always', MatplotlibDeprecationWarning)
try:
# This import triggers the internal loop in cmocean/cm.py
import cmocean
print("cmocean imported successfully (check above for warnings).")
except MatplotlibDeprecationWarning as e:
print(f"Caught the expected warning as an error: {e}")
Proposed fix
The N parameter can be omitted from the colors.ListedColormap instantiations inside cmocean/cm.py, as the passed color arrays (rgb_with_alpha and its reversed slice) are already scaled to the proper lengths (rgb.shape[0] and rgb_i.shape[0]).
- 主要語言
- Python
- 星號
- 272
- 分支
- 54
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
matplotlib/cmocean 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 45/100
matplotlib/cmocean#120 ·
-
難度 2/5 1-3 小時 新手友好度 50/100
matplotlib/cmocean#119 · 1 則留言 ·
-
難度 2/5 1-3 小時 新手友好度 52/100
matplotlib/cmocean#118 ·
-
難度 3/5 1-2 天 新手友好度 45/100
matplotlib/cmocean#116 ·
-
難度 3/5 1-2 天 新手友好度 35/100
matplotlib/cmocean#115 ·
查看 matplotlib/cmocean 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 62/100
earthtojake/text-to-cad#758 ·
維護者通常 1 天內回覆
-
domain:upgrades enhancement needs-triage
難度 2/5 1-3 小時 新手友好度 66/100
gke-labs/kube-agents#4634 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 62/100
agardnerIT/opamp-server-py#116 ·
-
難度 2/5 1-3 小時 新手友好度 72/100
維護者通常 1 天內回覆
-
enhancement good first issue
難度 2/5 1-3 小時 新手友好度 78/100
elviskahoro/sdk-python-attio#144 · 1 則留言 ·
維護者通常 1 天內回覆