[R] overlap two graph

Zhiliang Ma zma at jhu.edu
Tue Aug 11 08:13:16 CEST 2009


plot(allPoints, col=c(rep(2,201), rep(3,201)))

On Mon, Aug 10, 2009 at 9:54 PM, Hemavathi Ramulu<hema.ramulu at gmail.com> wrote:
> Hi everyone,
> I'm stuck again, need you all help.
>
> I managed to  plot the diagram using
>
> allPoints<-rbind(ellipsePoints(2,5, alpha = 30),ellipsePoints(2,5, alpha =
> 60))
> plot(allPoints)
>
> But now I want to have different color for each ellipsepoint(the diagram)
> such as
> ellipsePoints(2,5, alpha = 30) is red in color and ellipsePoints(2,5, alpha
> = 60) is green in color.
>
> I tried this
>
> allPoints<-rbind(ellipsePoints(2,5, alpha = 30),ellipsePoints(2,5, alpha =
> 60))
> plot(allPoints, col=2)
>
> This will has same color for all the points.
>
> Help me.
>
> Thanks alot.
>
>
>
>
> On Thu, Aug 6, 2009 at 11:37 PM, Scott Sherrill-Mix <
> shescott at mail.med.upenn.edu> wrote:
>
>> It really sounds like you want to use points(). Maybe I'm missing the
>> true question but ellipsePoints returns a 2 column matrix of point
>> coordinates so passing it's output to points() should plot those
>> points on whatever plot you currently have open (in this case the plot
>> of the previous ellipse). If you're looking for an alternative way to
>> do it, you could rbind the outputs together and then plot the whole
>> thing:
>> allPoints<-rbind(ellipsePoints(2,5, alpha = 30),ellipsePoints(2,5, alpha =
>> 60))
>> plot(allPoints)
>>
>> Scott
>>
>> Scott Sherrill-Mix
>> Department of Microbiology
>> University of Pennsylvania
>> 402B Johnson Pavilion
>> 3610 Hamilton Walk
>> Philadelphia, PA  19104-6076
>>
>>
>>
>> On Thu, Aug 6, 2009 at 3:15 AM, Hemavathi Ramulu<hema.ramulu at gmail.com>
>> wrote:
>> > Hi,
>> > actually there are coding before
>> > plot(ellipsePoints(2,5, alpha = 30), asp=1) which i got it from this
>> website
>> > http://www.biostat.wustl.edu/archives/html/s-news/2002-10/msg00186.html
>> >
>> > It only can draw one ellipse,
>> > Now I want to know how to add more ellipse in same diagram?
>> > thank you.
>> > On Wed, Aug 5, 2009 at 9:53 PM, Scott Sherrill-Mix
>> > <shescott at mail.med.upenn.edu> wrote:
>> >>
>> >> Did you try already try:
>> >> plot(ellipsePoints(2,5, alpha = 30), asp=1)
>> >> points(ellipsePoints(2,5, alpha = 60), asp=1,col='red')
>> >> ?
>> >>
>> >> Scott
>> >>
>> >>
>> >>
>> >>
>> >> Scott Sherrill-Mix
>> >> Department of Microbiology
>> >> University of Pennsylvania
>> >> 402B Johnson Pavilion
>> >> 3610 Hamilton Walk
>> >> Philadelphia, PA  19104-6076
>> >>
>> >>
>> >>
>> >>
>> >> On Wed, Aug 5, 2009 at 5:46 AM, Hemavathi Ramulu<hema.ramulu at gmail.com>
>> >> wrote:
>> >> > Hi everyone,I need you all help.
>> >> > I want to create few image in same diagram.
>> >> >
>> >> > For example, I wan draw two ellipse in same diagram.
>> >> >
>> >> >  plot(ellipsePoints(2,5, alpha = 60), asp=1)
>> >> > and
>> >> > plot(ellipsePoints(2,5, alpha = 30), asp=1)
>> >> >
>> >> > How to display both ellipse together? both is different in angle.
>> >> >
>> >> > Thank you.
>> >> > --
>> >> > Hemavathi Ramulu
>> >> >
>> >> >        [[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.
>> >> >
>> >
>> >
>> >
>> > --
>> > Hemavathi Ramulu
>> >
>>
>
>
>
> --
> Hemavathi Ramulu
>
>        [[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.
>




More information about the R-help mailing list