We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0c07515 commit d1db13aCopy full SHA for d1db13a
lib/matplotlib/backends/backend_nbagg.py
@@ -122,8 +122,12 @@ class NavigationIPy(NavigationToolbar2WebAgg):
122
def export(self):
123
buf = io.BytesIO()
124
self.canvas.figure.savefig(buf, format='png', dpi='figure')
125
- data = "<img src='data:image/png;base64,{0}'/>"
126
- data = data.format(b64encode(buf.getvalue()).decode('utf-8'))
+ # Figure width in pixels
+ pwidth = self.canvas.figure.get_figwidth()*self.canvas.figure.get_dpi()
127
+ # Scale size to match widget on HiPD monitors
128
+ width = pwidth/self.canvas._dpi_ratio
129
+ data = "<img src='data:image/png;base64,{0}' width={1}/>"
130
+ data = data.format(b64encode(buf.getvalue()).decode('utf-8'), width)
131
display(HTML(data))
132
133
0 commit comments