[R] lattice package - question on plotting lines

Tony ahirst at qwest.net
Tue May 23 04:10:43 CEST 2006


On Mon, 2006-05-22 at 18:36 -0700, Tim Smith wrote:
> Hi all,
>    
>   I was trying to plot a graph using the following data:
>    
>   method percent accuracy group
> A1 4 0.8529 cns
> A1 10 0.8412 cns
> A1 15 0.8235 cns
> A2 4 0.9353 cns
> A2 10 0.9412 cns
> A2 15 0.9471 cns
> A1 4 0.8323 col
> A1 10 0.8452 col
> A1 15 0.8484 col
> A2 4 0.8839 col
> A2 10 0.8677 col
> A2 15 0.8678 col
>    
>   ################# 
>   The code I'm using to generate the graphs is:
>    
>   ### code : 
>    
>   xyplot(accuracy ~ percent|group,data = k, groups = method, allow.multiple = TRUE, scales = "same",type="o", 
>   xlab = "% of genes", ylab = "Accuracy", main = " Accuracy ", aspect = 2/3,
>             panel = function(...) { 
>               panel.superpose(...) 
>         } 
> )
>    
>    
>   ####################
>    
>   I have tried to use the 'get' and 'set' functions of 'par()', but can't figured it out. I have two questions:
>    
>   i) How can I set it so that the line plotted for A1 in all the plots is 'solid', and the one for A2 is 'dotted' for both the groups (cns and col)
>    
>   ii) How can I set the abline feature to show a horizontal line at different points on the y-axis for each of the two graphs?
>    
>   Any help would be highly appreciated.
>    
>   many thanks.
>    
>    
>    
>    
> 
> 
> 
> 			
> ---------------------------------
> Sneak preview the  all-new Yahoo.com. It's not radically different. Just radically better. 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> 

Does this get you closer?

xyplot(accuracy ~ percent|group,data = k, groups = method,
allow.multiple = TRUE, scales = "same",type="o",
	  par.settings=list(superpose.line = list(lty=1:2)),   # added
  xlab = "% of genes", ylab = "Accuracy", main = " Accuracy ", aspect =
2/3,
            panel = function(...) { 
              panel.superpose(...) 
        } 
)
-- 
Tony <ahirst at qwest.net>



More information about the R-help mailing list