File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -2094,17 +2094,24 @@ def _set_device_pixel_ratio(self, ratio):
2094
2094
self ._device_pixel_ratio = ratio
2095
2095
return True
2096
2096
2097
- def get_width_height (self ):
2097
+ def get_width_height (self , physical = False ):
2098
2098
"""
2099
2099
Return the figure width and height in integral points or pixels.
2100
2100
2101
+ Parameters
2102
+ ----------
2103
+ physical : bool, default: False
2104
+ Whether to return true physical pixels or logical pixels. Physical
2105
+ pixels may be used by backends that support HiDPI, but still
2106
+ configure the canvas using its actual size.
2107
+
2101
2108
Returns
2102
2109
-------
2103
2110
width, height : int
2104
2111
The size of the figure, in points or pixels, depending on the
2105
2112
backend.
2106
2113
"""
2107
- return tuple (int (size / self .device_pixel_ratio )
2114
+ return tuple (int (size / ( 1 if physical else self .device_pixel_ratio ) )
2108
2115
for size in self .figure .bbox .max )
2109
2116
2110
2117
@classmethod
You can’t perform that action at this time.
0 commit comments