Set better starting xlim and ylim for custom viewers #2422
Merged
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.
Pull Request Template
Description
As pointed out in #2420 the documentation example for a Custom Viewer (the Shot Chart) does not work well with current versions of glue because the Shot Chart x and y limits are set to 0 - 1, which contains no data. For new users this looks like it's just not working. This fix does not require any changes to the example scripts; we add a custom
add_data
function that uses the Matplotlib bounding box to set some sensible initial limits if we haven't already set limits (which the example later does in asetup
function).Note that we can't use
axes.relim()
for this because hexbin returns a Collection which is not supported.Closes #2420