[R] ggsave() with width only
c@|@ndr@ @end|ng |rom rgzm@de
Mon Sep 6 17:06:15 CEST 2021
Yes Jeff, you are right. I hate manually editing figures too, but
sometimes I find it's still the easiest way (e.g. when you submit your
paper several times when journals have differing guidelines, or when you
build figures from several (sub)plots + other images, or when you
combine plots that a colleague has done in Python with your R plots). I
have the impression that at some point, there is always something to
edit by hand, no matter how much you've adjusted the graphical
parameters and even if you use all possible tools available for ggplot2...
I have thought a lot about it and, as it is, I am not sure it would be
worth the effort. I might be missing some arguments for it, but I would
actually like someone to show me how it could look like - this might
just be what I need to be convinced!
Dr. Ivan Calandra
RGZM - MONREPOS Archaeological Research Centre
56567 Neuwied, Germany
+49 (0) 2631 9772-243
On 06/09/2021 16:44, Jeff Newmiller wrote:
> 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
>> Imaging lab
>> RGZM - MONREPOS Archaeological Research Centre
>> Schloss Monrepos
>> 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!
More information about the R-help