plot in one unique x,y axis

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

plot in one unique x,y axis

Dr. Alireza Zolfaghari
Hi there,

does any one know how to plot the both d1 and d2 data in one unique x and y
axis?

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]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: plot in one unique x,y axis

Duncan Murdoch-2
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]]
>
> ______________________________________________
> [hidden email] 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.
>

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: plot in one unique x,y axis

Jim Lemon-4
Hi Dr. Zolfaghari,
Given that the probability of practically the same unusual question
coming from two people in quick succession is tiny unless it is about
a homework question, I was probably conned into answering a homework
question a day or two ago. Of course by the time I had decoded your
question and discovered that it wouldn't even run because of misnamed
functions and variables that weren't there, it supported my guess that
the example had been cobbled together from bits of existing code, the
provenance of which I do not wish to inquire. Your question was
probably something like:

Plot these data so that the values of the upper 20% of the "z"
variable are plotted in green and the rest are plotted in red. The
size of the circles should be proportional to the values of the "z"
variable.

I answered this question not long ago and I now realize that there is
an even simpler way to do it. I hope that you can work it out.

Jim


On Mon, Jan 26, 2015 at 9:15 AM, Duncan Murdoch
<[hidden email]> wrote:

> 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]]
>>
>> ______________________________________________
>> [hidden email] 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.
>>
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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.