Skip to content

Commit

Permalink
tweak colors in vignette
Browse files Browse the repository at this point in the history
  • Loading branch information
friendly committed Jun 22, 2023
1 parent db795a6 commit 6c4b7bc
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 9 deletions.
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Suggests:
knitr,
nnet,
rmarkdown,
scales,
spelling,
testthat,
tidyr
Expand Down
1 change: 1 addition & 0 deletions inst/WORDLIST
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Fienberg
frac
fulltime
ggplot
ggeffects
gradeschool
GSS
https
Expand Down
Binary file modified vignettes/fig/wlf-alt-plot-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified vignettes/fig/wlf-effect-plot-1-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified vignettes/fig/wlf-effect-plot-2-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified vignettes/fig/wlf-plot-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 20 additions & 9 deletions vignettes/nestedLogit.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -459,10 +459,15 @@ various levels of the other predictors, and to compose these into a single figur
#| fig.cap = "**plot method**: Predicted probabilities and 95 percent pointwise confidence envelopes of not working, working part-time, and working full-time",
#| fig.show = "hold"
op <- par(mfcol=c(1, 2), mar=c(4, 4, 3, 1) + 0.1)
plot(wlf.nested, "hincome", list(children="absent"), # left panel
xlab="Husband's Income", legend.location="top")
plot(wlf.nested, "hincome", list(children="present"), # right panel
xlab="Husband's Income", legend=FALSE)
col <- scales::hue_pal()(3) # ggplot discrete colors
plot(wlf.nested, "hincome", # left panel
other = list(children="absent"),
xlab = "Husband's Income",
legend.location="top", col = col)
plot(wlf.nested, "hincome", # right panel
other = list(children="present"),
xlab = "Husband's Income",
legend=FALSE, col = col)
par(op)
```

Expand Down Expand Up @@ -491,7 +496,8 @@ An alternative style of effect plot shows the fit as a stacked-area graph (in th
#| fig.height = 4,
#| fig.cap = "Stacked-area predictor effect plots for the nested-logit model fit to the `Womenlf` data"
plot(predictorEffects(wlf.nested),
axes=list(y=list(style="stacked")))
axes=list(y=list(style="stacked")),
lines=list(col=scales::hue_pal()(3)))
```

The computation and display of effect graphs are highly customizable. For details, see the documentation for the **effects** package.
Expand Down Expand Up @@ -553,10 +559,15 @@ Here's a graph of the alternative model:
#| fig.cap = "Predicted probabilities for the alternative nested-dichotomies model",
#| fig.show = "hold"
op <- par(mfcol=c(1, 2), mar=c(4, 4, 3, 1) + 0.1)
plot(wlf.nested.alt, "hincome", list(children="absent"), # left panel
xlab="Husband's Income", legend.location="top")
plot(wlf.nested.alt, "hincome", list(children="present"), # right panel
xlab="Husband's Income", legend=FALSE)
col <- scales::hue_pal()(3)
plot(wlf.nested.alt, "hincome", # left panel
others = list(children="absent"),
xlab="Husband's Income",
legend.location="top", col = col)
plot(wlf.nested.alt, "hincome", # right panel
others = list(children="present"),
xlab="Husband's Income",
legend=FALSE, col = col)
par(op)
```
Compare this to the previous graph for the original specification.
Expand Down

0 comments on commit 6c4b7bc

Please sign in to comment.