Skip to content

Rename the figure= kwarg of TiledDataset.plot to fig= - #747

Open
sr-dash wants to merge 4 commits into
DKISTDC:mainfrom
sr-dash:tiled-dataset-fig-kwarg
Open

Rename the figure= kwarg of TiledDataset.plot to fig=#747
sr-dash wants to merge 4 commits into
DKISTDC:mainfrom
sr-dash:tiled-dataset-fig-kwarg

Conversation

@sr-dash

@sr-dash sr-dash commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Fixes #593.

TiledDataset.plot() took the figure to draw into as figure=, while NDCube.plot() (and therefore Dataset.plot() for >2D data) takes it as fig=. This renames the TiledDataset.plot() keyword to fig and deprecates figure with astropy.utils.decorators.deprecated_renamed_argument, so existing code carries on working (with a DKISTDeprecationWarning) until the deprecation period is up.

The parameter keeps its position in the signature, so anyone passing it positionally is unaffected.

  • Renamed the keyword and updated the docstring, the tutorial (docs/tutorial/7_visualization.md) and the VBI extents example.
  • Added two tests: one that fig= returns the figure it was given, and one that figure= still works but warns.

I set the deprecation version to 1.19 on the assumption that's the next release — happy to change it.

Two things I wasn't sure about and left alone, let me know if you'd like them in this PR:

  • Inversion.plot() and Profiles.plot() also take figure=. They're experimental, but renaming them too would keep the whole package consistent.
  • I haven't added a changelog/ entry yet — added as 747.removal.rst.

sr-dash and others added 3 commits August 6, 2026 11:56
NDCube.plot uses fig= for the figure to draw into, while
TiledDataset.plot used figure=. Rename it to fig= for consistency and
deprecate figure= so existing code keeps working for now.

Closes DKISTDC#593
@Cadair

Cadair commented Aug 20, 2026

Copy link
Copy Markdown
Member

Hi! Thanks for the PR, I think it'd be good to change Inversion as well.

@Cadair
Cadair requested a review from SolarDrew August 20, 2026 13:27

@SolarDrew SolarDrew left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I agree, I'd like to have consistency with the Inversion and Profiles classes as well. Otherwise this looks good, thanks for fixing it.

Sign up for free to 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.

NDCube.plot (for >2D) accepts fig= and TiledDataset.plot accepts figure=

3 participants