Provide programmatic access valid interp options #3682
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Added an attribute to the imshow function in _axes.py that is named the same as the keyword argument 'interpolation' so that the valid options for interpolation can be accessed programmatically.
Purpose
I spoke with @tacaswell offline and he was unaware of any place in mpl where the valid options for the
interpolation
kwarg in axes.imshow() were available, thus this PR (which is probably the first of many, but I thought I'd see how this goes over before I do this in other places in mpl source). Such programmatic access to these kwargs is incredibly useful when constructing GUI widgets so that the valid options can be provided via a combo box.I can see a few different mechanisms by which these sorts of options can be provided programmatically, depending on how much you guys hate this change 😄.
Functions can have attributes added to them whose variable name matches the kwarg for that function.
These options can be created in each module where they're useful with the template
_opts_funcname_kwarg
.