diff --git a/gui/src/app/Scripting/pyodide/pyodideWorker.ts b/gui/src/app/Scripting/pyodide/pyodideWorker.ts index 049e0be2..3c6cce28 100644 --- a/gui/src/app/Scripting/pyodide/pyodideWorker.ts +++ b/gui/src/app/Scripting/pyodide/pyodideWorker.ts @@ -147,7 +147,8 @@ patch_matplotlib(_SP_ADD_IMAGE) postamble += ` import matplotlib.pyplot as plt -plt.show() +if len(plt.gcf().get_children()) > 1: + plt.show() `; } diff --git a/gui/src/app/Scripting/webR/runR.ts b/gui/src/app/Scripting/webR/runR.ts index 9d56ee87..f314ce81 100644 --- a/gui/src/app/Scripting/webR/runR.ts +++ b/gui/src/app/Scripting/webR/runR.ts @@ -30,8 +30,8 @@ const captureOutputOptions = { captureStreams: true, captureConditions: false, captureGraphics: { - width: 340, - height: 340, + height: 504, // default values for height and width + width: 504, bg: "white", // default: transparent pointsize: 12, capture: true, @@ -103,6 +103,7 @@ invisible(.SP_DATA)`; // Set canvas size to image canvas.width = img.width; canvas.height = img.height; + canvas.style.width = "100%"; // Draw image onto Canvas const ctx = canvas.getContext("2d");