[R] Editing figure without re-running the plotting code?

Jim Lemon jim at bitwrit.com.au
Sun Mar 10 23:47:10 CET 2013


On 03/11/2013 02:19 AM, Sherri Heck wrote:
> Dear all,
>
> I am curious if anyone knows of a command/program that would enable one to
> edit a figure in R once it is created (akin to Matlab).  Currently, if I
> need to make any changes to the figure I do so and then have to run the
> plotting portion of the code again.  I have searched the R site mailing
> lists, etc to no avail.  Any help is greatly appreciated.
>
Hi Sherri,
As Jeff has pointed out, graphics devices in R are almost entirely 
cumulative in operation. You can display something, then add something 
else, but you don't have a buffer for the various objects in a complex 
plot that allows those objects to be altered or deleted.

The playwith package would probably allow you to do what you want, but 
there is a certain amount of learning necessary and you have to navigate 
the complexity that is hidden in most interactive plotting packages. 
That said, if you have to do a lot of this, it is worth the effort.

What most of us do is to build plots up as scripts in an external editor 
and then "source" the scripts. You can make incremental changes and the 
new plot just pops up when you source the code.

Jim



More information about the R-help mailing list