File tree 1 file changed +9
-2
lines changed
1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -2080,17 +2080,24 @@ def _set_device_pixel_ratio(self, ratio):
2080
2080
self .figure ._set_dpi (dpi , forward = False )
2081
2081
self ._device_pixel_ratio = ratio
2082
2082
2083
- def get_width_height (self ):
2083
+ def get_width_height (self , physical = False ):
2084
2084
"""
2085
2085
Return the figure width and height in integral points or pixels.
2086
2086
2087
+ Parameters
2088
+ ----------
2089
+ physical : bool, default: False
2090
+ Whether to return true physical pixels or logical pixels. Physical
2091
+ pixels may be used by backends that support HiDPI, but still
2092
+ configure the canvas using its actual size.
2093
+
2087
2094
Returns
2088
2095
-------
2089
2096
width, height : int
2090
2097
The size of the figure, in points or pixels, depending on the
2091
2098
backend.
2092
2099
"""
2093
- return tuple (int (size / self .device_pixel_ratio )
2100
+ return tuple (int (size / ( 1 if physical else self .device_pixel_ratio ) )
2094
2101
for size in self .figure .bbox .max )
2095
2102
2096
2103
@classmethod
You can’t perform that action at this time.
0 commit comments