Matplotlib deprecation warning

オープン 初心者向け
#122 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

@KCollins がすでに取り組んでいます。

2026年11月1日 から。

  • #123 @KCollins による — オープン

評価

難易度
1/5
見積もり時間
1時間未満
初心者へのやさしさ
88/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
matplotlib, python

調査の方向性

非推奨の呼び出しは cmocean/cm.py にあり、colors.ListedColormap が N 引数付きでインスタンス化されています。再現するには、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 を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

matplotlib/cmocean のほかの issue

matplotlib/cmocean の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。