Editing figure without re-running the plotting code?
Jim: Whoaaa... this is only true for base graphics! For grid graphics -- on which both lattice and ggplot are built -- there is a defined object structure for graphics complete with extensive editing capabilities. See, e.g. ?grid.edit in the grid package. Both lattice and ggplot can and do take advantage of grid grobs - graphical objects, e.g. via updating and layering. Whether this is more or less convenient than editing graphics code is another issue, but the answer to the query is certainly "yes." I admit, however, that the modified displayed object must be redrawn -- you do not work directly and interactively with the display. But in many ways grid's programmatic editing and redisplay of modified grobs is more flexible and powerful, I would say. In any case, the editing capabilities exist. -- Bert
On Sun, Mar 10, 2013 at 3:47 PM, Jim Lemon <jim at bitwrit.com.au> wrote:
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
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Bert Gunter Genentech Nonclinical Biostatistics Internal Contact Info: Phone: 467-7374 Website: http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm