Thanks to visit codestin.com Credit goes to github.com
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.
2 parents 27a6e41 + d1db13a commit 5416da2Copy full SHA for 5416da2
1 file changed
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