Re: [R] Plotting from functions

2011-06-01 Thread David Scott
On 02/06/11 10:13, Duncan Murdoch wrote: On 01/06/2011 4:06 PM, Yang Zhang wrote: On Wed, Jun 1, 2011 at 1:04 PM, Yang Zhang wrote: I can plot to png's fine when i run this directly from the top-level script/console: png('diamonds.png');qplot(carat,price,data=diamonds);dev.off() But for som

Re: [R] Plotting from functions

2011-06-01 Thread Duncan Murdoch
On 01/06/2011 4:06 PM, Yang Zhang wrote: On Wed, Jun 1, 2011 at 1:04 PM, Yang Zhang wrote: I can plot to png's fine when i run this directly from the top-level script/console: png('diamonds.png');qplot(carat,price,data=diamonds);dev.off() But for some reason it's not working when that's in a

Re: [R] Plotting from functions

2011-06-01 Thread Joshua Wiley
Hi, Within functions, you often do need to wrap the plotting calls in print() (you would see this if you read the FAQ). Cheers, Josh On Wed, Jun 1, 2011 at 1:06 PM, Yang Zhang wrote: > On Wed, Jun 1, 2011 at 1:04 PM, Yang Zhang wrote: >> I can plot to png's fine when i run this directly from

Re: [R] Plotting from functions

2011-06-01 Thread Yang Zhang
On Wed, Jun 1, 2011 at 1:04 PM, Yang Zhang wrote: > I can plot to png's fine when i run this directly from the top-level > script/console: > > png('diamonds.png');qplot(carat,price,data=diamonds);dev.off() > > But for some reason it's not working when that's in a function: > > (function(){png('dia