Color of ecdf plots

View: New views
4 Messages — Rating Filter:   Alert me  

Color of ecdf plots

by Lars Bergemann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi.

 

I have the following two ecdf plots in one graph:

 

 plot(
  ecdf(....),
  do.points=FALSE,
  verticals=TRUE,
  main=paste("Ecdf of distances ",DIM,sep=""),
  col="red"
 );
 lines(
  ecdf(....),
  do.points=FALSE,
  verticals=TRUE
 );

 

How do I change the color of the resulting graph? Adding col="red" to either plot or lines results in an error ...

 

Thanks!

Lars

_________________________________________________________________
[[elided Hotmail spam]]

        [[alternative HTML version deleted]]

______________________________________________
R-help@... 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.

Re: Color of ecdf plots

by Uwe Ligges-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



Lars Bergemann wrote:

> Hi.
>
>  
>
> I have the following two ecdf plots in one graph:
>
>  
>
>  plot(
>   ecdf(....),
>   do.points=FALSE,
>   verticals=TRUE,
>   main=paste("Ecdf of distances ",DIM,sep=""),
>   col="red"
>  );
>  lines(
>   ecdf(....),
>   do.points=FALSE,
>   verticals=TRUE
>  );
>
>  
>
> How do I change the color of the resulting graph? Adding col="red" to either plot or lines results in an error ...


... but works for me.

Hence please specify your version of R, OS, exactly reproducible code
(above the argument to ecdf are missing, obviously).

Best,
Uwe Ligges


>  
>
> Thanks!
>
> Lars
>
> _________________________________________________________________
> [[elided Hotmail spam]]
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@... 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.

______________________________________________
R-help@... 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.

Re: Color of ecdf plots

by David Winsemius :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Does not work for me with rnorm(20) as an argument. (And supplying a  
dummy value for DIM.) The error after fixing the missing DIM issue was:
Error in plot.stepfun(x, ..., ylab = ylab, verticals = verticals, pch  
= pch) :
   argument 4 matches multiple formal arguments

  The help page for plot.ecdf refers me to plot.stepfun (and the error  
message did too) which does not have a col= argument but rather  
col.hor= and col.vert= . Using those arguments instead of col="red",  
it now "works".

plot(
    ecdf(rnorm(20)),
  do.points=FALSE,
  verticals=TRUE,
   main=paste("Ecdf of distances "),
   col.hor="red", col.vert="red"
  )

On Mac OS X 10.5.7, 64bit R 2.8.1

On Jul 3, 2009, at 12:24 PM, Uwe Ligges wrote:

>
>
> Lars Bergemann wrote:
>> Hi.
>> I have the following two ecdf plots in one graph:
>>  plot(
>>  ecdf(....),
>>  do.points=FALSE,
>>  verticals=TRUE,
>>  main=paste("Ecdf of distances ",DIM,sep=""),
>>  col="red"
>> );
>> lines(
>>  ecdf(....),
>>  do.points=FALSE,
>>  verticals=TRUE
>> );
>> How do I change the color of the resulting graph? Adding col="red"  
>> to either plot or lines results in an error ...
>
>
> ... but works for me.
>
> Hence please specify your version of R, OS, exactly reproducible  
> code (above the argument to ecdf are missing, obviously).
>
> Best,
> Uwe Ligges
>
>

David Winsemius, MD
Heritage Laboratories
West Hartford, CT

______________________________________________
R-help@... 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.

Re: Color of ecdf plots

by Roger Koenker-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

having been bitten by this behavior many times,  could I register a  
plea for
allowing a col argument to plot.stepfun that would deal with both the  
horizontal
and vertical segments -- I rather doubt that it is often desirable to  
have different
colors for these.  Note that verticals = TRUE is the default here so  
not strictly
necessary in the example below.


On Jul 3, 2009, at 12:34 PM, David Winsemius wrote:

> Does not work for me with rnorm(20) as an argument. (And supplying a  
> dummy value for DIM.) The error after fixing the missing DIM issue  
> was:
> Error in plot.stepfun(x, ..., ylab = ylab, verticals = verticals,  
> pch = pch) :
>  argument 4 matches multiple formal arguments
>
> The help page for plot.ecdf refers me to plot.stepfun (and the error  
> message did too) which does not have a col= argument but rather  
> col.hor= and col.vert= . Using those arguments instead of col="red",  
> it now "works".
>
> plot(
>   ecdf(rnorm(20)),
> do.points=FALSE,
> verticals=TRUE,
>  main=paste("Ecdf of distances "),
>  col.hor="red", col.vert="red"
> )
>
> On Mac OS X 10.5.7, 64bit R 2.8.1
>
> On Jul 3, 2009, at 12:24 PM, Uwe Ligges wrote:
>
>>
>>
>> Lars Bergemann wrote:
>>> Hi.
>>> I have the following two ecdf plots in one graph:
>>> plot(
>>> ecdf(....),
>>> do.points=FALSE,
>>> verticals=TRUE,
>>> main=paste("Ecdf of distances ",DIM,sep=""),
>>> col="red"
>>> );
>>> lines(
>>> ecdf(....),
>>> do.points=FALSE,
>>> verticals=TRUE
>>> );
>>> How do I change the color of the resulting graph? Adding col="red"  
>>> to either plot or lines results in an error ...
>>
>>
>> ... but works for me.
>>
>> Hence please specify your version of R, OS, exactly reproducible  
>> code (above the argument to ecdf are missing, obviously).
>>
>> Best,
>> Uwe Ligges
>>
>>
>
> David Winsemius, MD
> Heritage Laboratories
> West Hartford, CT
>
> ______________________________________________
> R-help@... 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.

______________________________________________
R-help@... 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.