Skip to content

Commit

Permalink
Merge pull request #165 from flatironinstitute/tweak-plots
Browse files Browse the repository at this point in the history
Tweak plot output appearance
  • Loading branch information
WardBrian authored Jul 29, 2024
2 parents e63959e + fbe8e8d commit 672186e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion gui/src/app/Scripting/pyodide/pyodideWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
`;
}

Expand Down
5 changes: 3 additions & 2 deletions gui/src/app/Scripting/webR/runR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit 672186e

Please sign in to comment.