Skip to content

regularize get_window_extent #4058

Closed
Closed
@tacaswell

Description

@tacaswell

The call signature on get_window_extent is not uniform, we should probably fix this.

tcaswell@eowyn:lib$ ack-grep 'def get_window_extent'
mpl_toolkits/axisartist/axis_artist.py
437:    def get_window_extent(self, renderer):
625:    def get_window_extent(self, renderer):
806:    def get_window_extents(self, renderer):

matplotlib/axes/_base.py
473:    def get_window_extent(self, *args, **kwargs):

matplotlib/artist.py
190:    def get_window_extent(self, renderer):

matplotlib/lines.py
531:    def get_window_extent(self, renderer):

matplotlib/image.py
1097:    def get_window_extent(self, renderer=None):

matplotlib/text.py
763:    def get_window_extent(self, renderer=None, dpi=None):
1285:    def get_window_extent(self, renderer=None):
2088:    def get_window_extent(self, renderer=None):

matplotlib/figure.py
490:    def get_window_extent(self, *args, **kwargs):

matplotlib/offsetbox.py
252:    def get_window_extent(self, renderer):
618:    def get_window_extent(self, renderer):
769:    def get_window_extent(self, renderer):
884:    def get_window_extent(self, renderer):
1058:    def get_window_extent(self, renderer):
1265:    def get_window_extent(self, renderer):

matplotlib/patches.py
490:    def get_window_extent(self, renderer=None):

matplotlib/legend.py
798:    def get_window_extent(self, *args, **kwargs):

matplotlib/table.py
288:    def get_window_extent(self, renderer):

matplotlib/collections.py
207:    def get_window_extent(self, renderer):

  • for Axes and Figure the arguments are ignored, in legend they are passed through to Patch's . These should probably be given explicit arguments.
  • Text effectively implements a context manager on the figure.dpi. From the doc-string this seems like it is for making image maps for web images easy, but there has to be a better way to do this.
  • if we are going to let artists cache the renderer, it should happen at the artist level, not on a per-subclass basis

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions