[R] Color of ecdf plots

roger koenker roger at ysidro.econ.uiuc.edu
Fri Jul 3 20:13:44 CEST 2009


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