glue-viz / glue

Linked Data Visualizations Across Multiple Files
http://glueviz.org
Other
740 stars 153 forks source link

Set better starting xlim and ylim for custom viewers #2422

Closed jfoster17 closed 1 year ago

jfoster17 commented 1 year ago

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 a setup function).

Note that we can't use axes.relim() for this because hexbin returns a Collection which is not supported.

Closes #2420