[R] plot in one unique x,y axis

Duncan Murdoch murdoch.duncan at gmail.com
Sun Jan 25 23:15:46 CET 2015


On 25/01/2015 2:38 PM, Dr. Alireza Zolfaghari wrote:
> Hi there,
> 
> does any one know how to plot the both d1 and d2 data in one unique x and y
> axis?

Use plot() for the first call, and points() for the second one.  You may
need to specify xlim and/or ylim explicitly in the first call to be sure
they cover the full range of both datasets.

Duncan Murdoch

> 
> thanks
> Alireza
> 
> 
> convertToRadius<-function(x){return(sqrt(x/pi))}
> 
> myd=data.frame(x=c(84390255386 ,74390255386, 78028317380 ,53594648044,422)
>                ,y=c(949849442 ,941645043, 840135292, 74, 821632939)
>                ,z=c(0.005641896, 0.005641896 ,0.005641896,
> 0.007978846,0.007978846))
> 
> 
> v=max(myd$z)*0.80
> d1=myd[myd$z<v,]
> d2=myd[myd$z>=v,]
> 
> par(plt=c(0.1,0.92,0.1,1))
> myd =d1
> z=cvtToRadius(myd$z)*scale
> y=myd$y
> x=myd$x
> plot(x,y,cex=z,col='red')
> 
> par(plt=c(0.1,0.92,0.1,1),new=TRUE)
> myd =d2
> z=cvtToRadius(myd$z)*scale
> y=myd$y
> x=myd$x
> plot(x,y,cex=z,col='green')
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
>



More information about the R-help mailing list