diff --git a/lib/matplotlib/backends/web_backend/js/mpl.js b/lib/matplotlib/backends/web_backend/js/mpl.js index 355d385568ac..05ed0e1b7187 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); } }