`stream`: streamlines stuck in default colour scale

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

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

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

調査の方向性

まず cf-plot の stream 実装と、それが matplotlib の streamplot を呼び出す箇所を見つけてください。それを、cscale が plotvars にどのように保存され、cbar によってどのように使われるかと比較してください。提供された MRE で再現し、次に cfp.cscale("plasma") を設定すると、追加の stream kwargs なしでカラーバーと流線の色の両方が変わることを確認してください。完了とは、流線が有効なカラースケールを継承し、既存の例が引き続きレンダリングされることを意味します。

索引モデルが issue の本文から書いたものです。

説明

bug

There is no way to customise the colour scale in which the streamlies are displayed in a stream function - the colour bar scale can be edited and displays in the specified colour scale, but the streamlines themselves don't match. I can't see any way from the stream keywords to set this, though really it should pick up on the config. for the set cscale value without having to be specified again separately, so that's a moot point.

MRE

This is basically Example 16c, with some minor config. removed, and the setting of the colour scale changed from the default to 'plasma' (anything other than the default 'viridis' will do!).

   # u, v being compatible eastward and northward wind vector fields
   magnitude = (u--2 + v--2) -- 0.5
   mag = np.squeeze(magnitude.array)  # ignore this inefficiency which I will update

    # Can set a colour scale to change colour bar, but it
    # doesn't change the streamlines colours to match
    # colour scale, and no stream function kwargs expose
    # a way to do this that doesn't involve manipulating the
    # underlying matplotlib object 
   cfp.cscale("plasma", ncols=13)  

   cfp.gopen()
   cfp.stream(u=u, v=v, density=2, color=mag)
   cfp.cbar(
       levs=cfp.plotvars.levels,
       position=[0.12, 0.12, 0.8, 0.02],
       title="Wind magnitude",
   )
   cfp.gclose()
主要言語
Python
スター
21
フォーク
11
平均マージ
3時間 7分
マージ済み PR(30日)
11

環境構築

はじめの一歩

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

NCAS-CMS/cf-plot のほかの issue

NCAS-CMS/cf-plot の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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