Skip to content
Back to formatted view

Raw Message

Message-ID: <1F817A73-D4A1-4B0B-8625-F8E7975B7169@dcn.davis.ca.us>
Date: 2021-09-06T14:44:25Z
From: Jeff Newmiller
Subject: ggsave() with width only
In-Reply-To: <5a218981-c1f2-ea50-d6b1-ba5b8d0a827e@rgzm.de>

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 at 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?
>
>Ivan
>
>--
>Dr. Ivan Calandra
>Imaging lab
>RGZM - MONREPOS Archaeological Research Centre
>Schloss Monrepos
>56567 Neuwied, Germany
>+49 (0) 2631 9772-243
>https://www.researchgate.net/profile/Ivan_Calandra
>
>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 at 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
>>> correct.
>>>
>>> Thank you for the tip!
>>> Ivan
>>>

-- 
Sent from my phone. Please excuse my brevity.