Skip to content

Let plot_dataset take back the colorbars it returns - #8448

Open
Jens Hedegaard Nielsen (jenshnielsen) wants to merge 1 commit into
microsoft:mainfrom
jenshnielsen:colorbar_types
Open

Let plot_dataset take back the colorbars it returns#8448
Jens Hedegaard Nielsen (jenshnielsen) wants to merge 1 commit into
microsoft:mainfrom
jenshnielsen:colorbar_types

Conversation

@jenshnielsen

Copy link
Copy Markdown
Collaborator

plot_dataset returns a list of colorbars whose entries are None for the 1D plots, but its colorbars argument only accepted a sequence that was either all colorbars or all None. Passing the result back in, which is how the offline plotting tutorial plots into the same axes again, was therefore a type error.

Take a Sequence[Colorbar | None]. A Sequence[Colorbar] is still one of those, so nothing that worked before stops working, and the body already built and handled lists containing None.

plot_by_id forwards to plot_dataset and returns the same type, so it is widened with it.

Lifted from #8441

plot_dataset returns a list of colorbars whose entries are None for the
1D plots, but its colorbars argument only accepted a sequence that was
either all colorbars or all None. Passing the result back in, which is
how the offline plotting tutorial plots into the same axes again, was
therefore a type error.
Take a Sequence[Colorbar | None]. A Sequence[Colorbar] is still one of
those, so nothing that worked before stops working, and the body already
built and handled lists containing None.
plot_by_id forwards to plot_dataset and returns the same type, so it is
widened with it.
@codecov

codecovBot commented Aug 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.12%. Comparing base (f12be6b) to head (a4d158a).

Additional details and impacted files
@@ Coverage Diff @@## main #8448 +/- ##
=======================================
Coverage 71.12% 71.12% =======================================
Files 305 305 Lines 31952 31952 =======================================
Hits 22725 22725 Misses 9227 9227 

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@jenshnielsen