From df7f639ad447449ec98c405d6afdbe87760281dd Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Thu, 17 Dec 2020 10:03:43 -0500 Subject: [PATCH] Backport PR #19131: Fix WebAgg initialization --- lib/matplotlib/backends/web_backend/js/mpl.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/matplotlib/backends/web_backend/js/mpl.js b/lib/matplotlib/backends/web_backend/js/mpl.js index a3a8f7abc54b..5d27a5835942 100644 --- a/lib/matplotlib/backends/web_backend/js/mpl.js +++ b/lib/matplotlib/backends/web_backend/js/mpl.js @@ -157,9 +157,6 @@ mpl.figure.prototype._init_canvas = function () { 1; this.ratio = (window.devicePixelRatio || 1) / backingStore; - if (this.ratio !== 1) { - fig.send_message('set_dpi_ratio', { dpi_ratio: this.ratio }); - } var rubberband_canvas = (this.rubberband_canvas = document.createElement( 'canvas' @@ -227,7 +224,7 @@ mpl.figure.prototype._init_canvas = function () { // And update the size in Python. We ignore the initial 0/0 size // that occurs as the element is placed into the DOM, which should // otherwise not happen due to the minimum size styling. - if (width != 0 && height != 0) { + if (fig.ws.readyState == 1 && width != 0 && height != 0) { fig.request_resize(width, height); } }