[Rd] Request for a crop option on R's standard plot context menu

Marthews, Toby R. tobm@r @end|ng |rom ceh@@c@uk
Thu Feb 11 17:55:14 CET 2021


Dear R Dev,

I hope you don't mind a request for a feature from a long-time R user (happily using R since 2005).

I use R for lots of plotting for my work, e.g. for my current project I have a script that generates 300 plots. I generally copy these all as bitmaps and put them directly into a Word document for my report (see e.g. attached screenshot).

I am always required to maximise the plots to get the best resolution, but that always means I get lots of white space when I copy the plot into Word. Cropping them takes a reasonable amount of time (e.g. an entire day to crop all 300 for this project).

I'm wondering whether it would be possible to have an option added to the plot window context menu for "Cropped bitmap" or "Crop whitespace"? I think this would be VERY useful because all the online tools I've seen for batch-cropping a set of images require the same crop to be applied to all images (e.g. https://www.youtube.com/watch?v=icbpS0OH9a0 ) and that's not the case for my plots (some of my plots are panel plots, some simpler plots).

I know it's a bit cheeky to ask for something that I have no idea how to code up myself: I am just hoping that this feedback might go somewhere useful. R can really do 99% of things kind of perfectly so it seems churlish to point out the 1%, but if this is an easy thing to add in then at least I would use it pretty much every project I work on!

Many thanks and best regards,

Best regards,

Toby

PS. I know I could modify my script so that it creates windows of exactly the right size (dev.new), but doing that would mean I would have to recalculate the sizes if I changed anything on the plots at all (e.g. aspect, x label) so I would lose probably more time pursuing that option. Also, I've found that using lots of dev.new commands makes it difficult for colleagues who use RStudio to use my scripts.
   I am also aware I could export these images as pdfs, but then I would have to open 300 pdfs, extract the images and crop them all in 3rd party software. Again, perfectly possible but I am searching for a slightly quicker solution (!).


Dr Toby Marthews

UKCEH Band 6 Researcher in Global Surface Science (Hydro-Climate Risks)

   Mob: +44 753 2168305, web: www.tobymarthews.com<http://www.tobymarthews.com>



This email and any attachments are intended solely for the named recipients and are confidential. If you are not the intended recipient please reply to the email to highlight the error and delete this email from your system; you must not use, disclose, copy or distribute this email or any of its attachments. UKCEH has taken every reasonable precaution to minimise risk of this email or any attachments containing viruses or malware but the recipient should carry out its own virus and malware checks before opening the attachments. UKCEH does not accept any liability for any losses or damages which the recipient may sustain due to presence of any viruses. Opinions, conclusions or other information in this message and attachments that are not related directly to UKCEH business are solely those of the author and do not represent the views of UKCEH. We process your personal data in accordance with our Privacy Notice, available on the UKCEH website.
https://www.ceh.ac.uk/privacy-notice

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Plot context menu.png
Type: image/png
Size: 100320 bytes
Desc: Plot context menu.png
URL: <https://stat.ethz.ch/pipermail/r-devel/attachments/20210211/eee7ee24/attachment.png>


More information about the R-devel mailing list