MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / get_width_height

Method get_width_height

lib/matplotlib/backend_bases.py:2042–2064  ·  view source on GitHub ↗

Return the figure width and height in integral points or pixels. When the figure is used on High DPI screens (and the backend supports it), the truncation to integers occurs after scaling by the device pixel ratio. Parameters ---------- phys

(self, *, physical=False)

Source from the content-addressed store, hash-verified

2040 return True
2041
2042 def get_width_height(self, *, physical=False):
2043 """
2044 Return the figure width and height in integral points or pixels.
2045
2046 When the figure is used on High DPI screens (and the backend supports
2047 it), the truncation to integers occurs after scaling by the device
2048 pixel ratio.
2049
2050 Parameters
2051 ----------
2052 physical : bool, default: False
2053 Whether to return true physical pixels or logical pixels. Physical
2054 pixels may be used by backends that support HiDPI, but still
2055 configure the canvas using its actual size.
2056
2057 Returns
2058 -------
2059 width, height : int
2060 The size of the figure, in points or pixels, depending on the
2061 backend.
2062 """
2063 return tuple(int(size / (1 if physical else self.device_pixel_ratio))
2064 for size in self.figure.bbox.max)
2065
2066 @classmethod
2067 def get_supported_filetypes(cls):

Callers 15

__init__Method · 0.80
print_rgbaMethod · 0.80
__init__Method · 0.80
draw_textMethod · 0.80
__init__Method · 0.80
__init__Method · 0.80
sizeHintMethod · 0.80

Calls

no outgoing calls

Tested by 5

test_ft2font_clearFunction · 0.64
test_ft2font_set_sizeFunction · 0.64
test_ft2font_set_textFunction · 0.64
test_ft2font_loadingFunction · 0.64