[R] Exporting an rgl graph

(Ted Harding) Ted.Harding at manchester.ac.uk
Thu Apr 15 13:18:28 CEST 2010


On 15-Apr-10 10:10:54, Barry Rowlingson wrote:
> On Thu, Apr 15, 2010 at 10:24 AM,  <cgenolin at u-paris10.fr> wrote:
>> Hi the list,
>>
>> I use rgl to produce a 3D graph. I would like to "show" this graph
>> to some collaborator. Is there a way to save it and send it to
>> someone else?
> 
> See ?rgl.postscript and ?rgl.snapshot
> 
>  Or use some kind of screen capture system - on Windows the 'Print
> Screen' key can copy the screen to the clipboard, paste into Photoshop
> or other graphics program.
> 
>  On Linux, I use 'scrot' from the command line - type 'scrot -s',
> click on a window, and it makes a PNG file of it.

Again on Linux, since ImageMagick is installed, I use the 'import'
programme from that suite. When you start that, it produces a
"+"-shaped mouse cursor which you can use (selecting a top-left-hand
corner to start with, and holding down the left mouse button) to
drag out a bounding frame for the part of the screen you want to
save. Then, when you release the button, an image of that portion
of the screen is saved to a file of your choice, in any graphics
format of your choice that is supported by ImageMagick (including
PS and EPS, as well as all the common butmap formats).

See 'man import' for pointers to more information.

I have this set up as an icon on my "launch" panel, so it is just
a matter of clicking on that, and then doing the above. The command
behind the icon is

  /usr/local/bin/mkscreengrab

and my script file 'mkscreengrab' contains:

  #! /bin/bash
  export ScrGrbTmp=`mktemp /home/ted/Screengrabs/screengrabXXXX`
  import $ScrGrbTmp.jpg
  rm $ScrGrbTmp

so this makes JPEGs (I could have chosen somthing else, but that's
the default I mostly want for that activity). This produces a file
with a name like "screengrab4913.jpg" which will be unique in that
directory, and it can later be renamed to your taste.

If I wanted a different file format, I would use 'import' from
the command line, with appropriate filenam extension (e.g. ".png",
".ps", ".eps", ... ).

I hadn't heard of scrot before, but now I've looked it up it
seems that its output format is limited to PNG.

I've now also located more info about various ways of taking
screenshots in Linux:

http://tips.webdesign10.com/how-to-take-a-screenshot-on-ubuntu-linux

Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 15-Apr-10                                       Time: 12:18:25
------------------------------ XFMail ------------------------------



More information about the R-help mailing list