[R] ggsave() with width only
jdnewm|| @end|ng |rom dcn@d@v|@@c@@u@
Mon Sep 6 16:44:25 CEST 2021
I don't always use rmarkdown to write papers either, but you can capture figures from it. I avoid hand editing figures like the plague of irreproducibility. But sometimes you get stuck in an approach... I cannot answer your original post, but wanted to point out that it may not actually be necessary to answer it if you change your approach.
On September 6, 2021 7:29:34 AM PDT, Ivan Calandra <calandra using rgzm.de> wrote:
>Thank you Jeff for your answer.
>I do use rmarkdown but I do not write papers completely with it. I do
>output a report in HTML but I also like to export the plots as PDF so
>that I can edit them (using Inkscape or similar) if and as needed.
>And because I like to have both the HTML report including plots and
>extra plots as PDF, I cannot use pdf(). That's why I use ggsave().
>Or am I missing something?
>Dr. Ivan Calandra
>RGZM - MONREPOS Archaeological Research Centre
>56567 Neuwied, Germany
>+49 (0) 2631 9772-243
>On 06/09/2021 16:24, Jeff Newmiller wrote:
>> I use an rmarkdown file to generate consistent output figures and tables for html or Word. I just use Rnw files directly if I am generating LaTeX. I do not use R files for building output... and I never use ggsave. So you might consider altering your approach to bypass the question entirely.
>> On September 6, 2021 7:03:46 AM PDT, Ivan Calandra <calandra using rgzm.de> wrote:
>>> Dear useRs,
>>> I produce several independent ggplot2 plots and I would like to save
>>> them to a fixed width (for publications), but the height (and therefore
>>> aspect ratio) is different from plot to plot.
>>> How can I save my plots with ggsave() supplying only a fixed width but
>>> without knowing the height nor the aspect ratio? If I specify the width
>>> only, the plots are truncated in width because the aspect ratio is not
>>> Thank you for the tip!
Sent from my phone. Please excuse my brevity.
More information about the R-help