Re: [Rd] Saving a plot in R-LINUX

From: <>
Date: Mon 16 Jan 2006 - 03:10:38 GMT


The command 'dev2bitmap(plotname, type="jpeg")' does the trick too.

Thanks to all those who sent helpful tips. It seems that I am posting these questions to the wrong list, my apologies!



Augusto Sanabria. MSc, PhD.
Mathematical Modeller
Risk Research Group
Geospatial & Earth Monitoring Division
Geoscience Australia (
Cnr. Jerrabomberra Av. & Hindmarsh Dr.
Symonston ACT 2609
Ph. (02) 6249-9155    

-----Original Message-----
From: [] On Behalf Of Vaidotas Zemlys
Sent: Saturday, 14 January 2006 12:10 AM To:
Subject: Re: [Rd] Saving a plot in R-LINUX

On 1/13/06, Dirk Eddelbuettel <> wrote:
> On 13 January 2006 at 11:02, wrote:
> | Is there any way to save a plot produced by
> | R in a LINUX (Debian) machine?
> It is the same on every platform and ...
> | The window opened by R to put the plot in,
> | does not give any option to save it (there
> | are options to move, close, minimise it, etc.
> | but not to save it). How do you do that?

What about using dev.copy? Or am I missing something? In windows there is a context menu when you click with the right mouse button, which lets you choose how do you want to save the plot. On linux I came up with such function, which albeit not perfectly but does the job:

d2b <-
function(file="Rplot%d.bmp",height=4,width=4,res=150,which=dev.cur(),...) {

    if(which!=dev.cur()) {

        cur <- dev.cur()

    else cur <- NULL  

dev.copy(device=bitmap,file=file,height=height,width=width,point=8,res=res,.. .)
    else dev.set(which)

It copies told device (current by default) to bitmap file. This function could be easily adapted for copying to other formats.

Since the answer was too easy, probably I did not understand question correctly. In that case please ignore this message.

Vaidotas Zemlys

Doctorate student,
Vilnius University

______________________________________________ mailing list

______________________________________________ mailing list
Received on Mon Jan 16 14:16:25 2006

This archive was generated by hypermail 2.1.8 : Mon 16 Jan 2006 - 08:33:13 GMT