[R] Change colour of line in logi.hist.plot

Göran Bergqvist Goran.Bergqvist at jagareforbundet.se
Mon Nov 6 07:58:08 CET 2017

Thank you. This worked fine.

-----Ursprungligt meddelande-----
Från: David Winsemius [mailto:dwinsemius at comcast.net] 
Skickat: den 5 november 2017 18:17
Till: Göran Bergqvist <Goran.Bergqvist at jagareforbundet.se>
Kopia: r-help at r-project.org
Ämne: Re: [R] Change colour of line in logi.hist.plot

> On Nov 5, 2017, at 6:03 AM, Göran Bergqvist <Goran.Bergqvist at jagareforbundet.se> wrote:
> I am using the function logi.hist.plot in package popbio. I want to change the colour of the probability line from the default red to black. I have not been able to find out how to do that.

If you look at the code for that function you see this line:

logi.curve <- function(independ, depend, mod = logi.mod, 
        col.cur = "red", lwd.cur = 4) {
Since it's the only occurence of "red" that's probably where "the money lies". You can either do a "hard hack" where you alter the value of the parameters to that inner function,

... or you can add a named parameter after the dots in the outer parameter list such as:

 function (independ, depend, logi.mod = 1, type = "dit", boxp = TRUE, 
    rug = FALSE, ylabel = "Probability", ylabel2 = "Frequency", 
    xlabel = "", mainlabel = "", las.h = 1, counts = FALSE, ...,  col.cur = "red")

... and modify the inner function to read:

     logi.curve <- function(independ, depend, mod = logi.mod, 
        col.cur = col.cur, lwd.cur = 4) {

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

David Winsemius
Alameda, CA, USA

'Any technology distinguishable from magic is insufficiently advanced.'   -Gehm's Corollary to Clarke's Third Law

More information about the R-help mailing list