Skip to content

Conversation

@hoyer-a
Copy link
Member

@hoyer-a hoyer-a commented Oct 28, 2025

Changes proposed in this pull request:

  • return colorbar for balloon plot
  • allow input of 2 axes as tuple, list or array
  • plot colorbar on second axis

Discussion

  • plotting the colorbar on an axis only works for projections 'polar' and 'rectilinear' and only makes sense for 'rectilinear'. Therefore i would force the second passed ax to be 'rectilinear' and throw an error otherwise.

The if function.__name__ in ... cases in the tests can be removed once all plot functions are adjusted.

Depends on #214

@hoyer-a hoyer-a added enhancement New feature or request plot labels Oct 28, 2025
@hoyer-a hoyer-a added this to the v1.0.0 milestone Oct 28, 2025
@hoyer-a hoyer-a moved this from Backlog to Open Discussion in Weekly Planning Oct 28, 2025
@hoyer-a hoyer-a requested review from a team, ahms5, f-brinkmann, mberz, sikersten and tluebeck October 28, 2025 18:57
Copy link
Member

@sikersten sikersten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, very nice!

@github-project-automation github-project-automation bot moved this from Open Discussion to Reviewer Approved in Weekly Planning Oct 30, 2025
Copy link
Member

@ahms5 ahms5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks, just one question out the retrun of ax.

@github-project-automation github-project-automation bot moved this from Reviewer Approved to Require review in Weekly Planning Nov 11, 2025
@hoyer-a hoyer-a requested a review from ahms5 November 11, 2025 19:33
Copy link
Member

@ahms5 ahms5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks looks good, just have a minor optional suggesstion, approved anyways.

Comment on lines 154 to 161
if function.__name__ in ["balloon"]:
cb = function(coords, data, colorbar=colorbar)[2]
out = function(coords, data, colorbar=colorbar)
if colorbar:
assert isinstance(cb, mpl.colorbar.Colorbar)
assert isinstance(out[2], mpl.colorbar.Colorbar)
assert isinstance(out[0], list)
if not colorbar:
assert cb is None
assert out[2] is None
assert isinstance(out[0], plt.Axes)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very optional: could be a dedicated test for testing the outputs for ballon plots

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about that too, but it would be very redundant to what is already tested.

@github-project-automation github-project-automation bot moved this from Require review to Reviewer Approved in Weekly Planning Nov 13, 2025
@mberz
Copy link
Member

mberz commented Nov 13, 2025

The if function.__name__ in ... cases in the tests can be removed once all plot functions are adjusted.

Could you please elaborate what you mean by this? If this information needs to survive beyond this PR, please open an issue.

@hoyer-a
Copy link
Member Author

hoyer-a commented Nov 13, 2025

To have the tests run without failing i added cases for the refactored functions with new ax and colorbar returns.
Since i am collection in a branch (plot/ax_colorbar_refactor) until all plot functions have been adjusted, i would create a PR from this branch and put it in a todo.

e.g.:

@pytest.mark.parametrize(("function", "projection"), [
    (sp.plot.balloon, '3d'),
    (sp.plot.balloon_wireframe, '3d'),
     ...
    ])
def test_data_plots_projection_input_and_return(function, projection):
    ...

    if function.__name__ in ['balloon']:
        ax_out = ax_out[0]
    # check if the returned axis has the correct projection

@hoyer-a
Copy link
Member Author

hoyer-a commented Nov 13, 2025

Also #214 should be merged first

@mberz
Copy link
Member

mberz commented Nov 13, 2025

Also #214 should be merged first

I've updated the description to include this information.

Base automatically changed from plots/add_utils_functions to plot/ax_colorbar_refactor November 14, 2025 13:38
@mberz mberz changed the base branch from plot/ax_colorbar_refactor to refactor/collect_cb_changes November 14, 2025 16:28
@mberz mberz merged commit f91bbba into refactor/collect_cb_changes Nov 14, 2025
10 of 11 checks passed
@github-project-automation github-project-automation bot moved this from Reviewer Approved to Done in Weekly Planning Nov 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request plot

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants