You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The idea is the put the code in #| label: hidden-function in a separate file -- for decluttering purposes -- and use source(file) in the .qmd file that generates your plots.
Also, I tried using the quarto default #| layout-ncol: 2, but that produced way too much whitespace between the two plots, so I use patchwork here instead. I'm sure a native quarto solution can be found.
plot_layout: "1x2" triggers the knitr hook registered by apply_fig_settings,
which widens fig.width to fill full text width while preserving the text-scale
invariant (out.width / fig.width = constant). Each subplot renders with fig.asp aspect ratio but is shorter than the single plot, because it is also
narrower. Of course, plot_layout: 1x2 can be replaced by whatever size grid is desired.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
The goal of this REPREX is to find a method that applies less guesswork when adding new plot-grids to a pdf-report by using sensible defaults.
Since I have had some issues with plot scaling when rendering pdf-reports using quarto, I came up with a solution that I think works ok.
I worked on this after submitting Issue #14252.
The idea is the put the code in
#| label: hidden-functionin a separate file -- for decluttering purposes -- and usesource(file)in the .qmd file that generates your plots.Also, I tried using the quarto default
#| layout-ncol: 2, but that produced way too much whitespace between the two plots, so I usepatchworkhere instead. I'm sure a native quarto solution can be found.Appriciate any feedback / suggestions!
Single plot (default sizing)
Two plots side by side (
plot_layout: "1x2")Reference: R4DS — Figure sizing
plot_layout: "1x2"triggers the knitr hook registered byapply_fig_settings,which widens
fig.widthto fill full text width while preserving the text-scaleinvariant (
out.width / fig.width = constant). Each subplot renders withfig.aspaspect ratio but is shorter than the single plot, because it is alsonarrower. Of course,
plot_layout: 1x2can be replaced by whatever size grid is desired.Beta Was this translation helpful? Give feedback.
All reactions