Change colour of line in logi.hist.plot

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Change colour of line in logi.hist.plot

Göran Bergqvist
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.

        [[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: Change colour of line in logi.hist.plot

Bert Gunter-2
Warning: Untested.

Note the "..." argument in the functions Help docs. This means "additional
optional arguments," which are passed down to underlying function calls.
The question is: what arguments? For plotting functions, especially those
using base graphics, it usually means the same sort of optional arguments
one would use for the plain plot.default() function. Lattice graphics is
somewhat similar for many of these arguments; ggplot graphics quite
different. But anyway, have a look at ?plot.default and try col = "black"
or maybe "col.line" = black. If this doesn't work (and you may have already
have tried this), hopefully someone else will have a better answer.

Cheers,
Bert





Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )

On Sun, Nov 5, 2017 at 6:03 AM, Göran Bergqvist <
[hidden email]> 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.
>
>         [[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.
>

        [[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: Change colour of line in logi.hist.plot

David Winsemius
In reply to this post by Göran Bergqvist

> On Nov 5, 2017, at 6:03 AM, Göran Bergqvist <[hidden email]> 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]]
>
> ______________________________________________
> [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.

David Winsemius
Alameda, CA, USA

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

______________________________________________
[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: Change colour of line in logi.hist.plot

Göran Bergqvist
Thank you. This worked fine.

-----Ursprungligt meddelande-----
Från: David Winsemius [mailto:[hidden email]]
Skickat: den 5 november 2017 18:17
Till: Göran Bergqvist <[hidden email]>
Kopia: [hidden email]
Ämne: Re: [R] Change colour of line in logi.hist.plot


> On Nov 5, 2017, at 6:03 AM, Göran Bergqvist <[hidden email]> 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]]
>
> ______________________________________________
> [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.

David Winsemius
Alameda, CA, USA

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





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