[R] plot inside function does not work

Claudia Beleites cbeleites at units.it
Mon Nov 22 14:34:02 CET 2010


Alex, this may be FAQ 7.22

Claudia

On 11/22/2010 02:19 PM, Alaios wrote:
> Hello everyone,
> when I commit a plot using console(command line?) plot works fine. I have created a function that plots based on the input. This function is called plot_shad. When I call this function alone in the command line I get my plot.
>
> Then I tried to use another function as depicted_below to do some calculation before calling the function that does the plotting.
>
> plot_shad_map<-function(f,CRagent,agentid){
> � for (i in c(1:nrow(shad_map))){
> ��� for (j in c(1:ncol(shad_map))){
> ���� # Do something
> ��� }
> � }
> � plot_shad_f(shad_map) # This plots fine when used in command line. But inside this #function does not
> � return(shad_map)
> }
>
> Unfortunately I get no plot . What might be the problem?
>
> One more question how to get more plots at the same time. It seems that when I issue a new plot replaces the old plot.
>
> I would like to thank you in advance for you help
> Regards
> Alex
>
>
>
>
> 	[[alternative HTML version deleted]]
>
>
>
>
> ______________________________________________
> 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.


-- 
Claudia Beleites
Dipartimento dei Materiali e delle Risorse Naturali
Università degli Studi di Trieste
Via Alfonso Valerio 6/a
I-34127 Trieste

phone: +39 0 40 5 58-37 68
email: cbeleites at units.it



More information about the R-help mailing list