Skip to content

Commit 6c4b7bc

Browse files
committed
tweak colors in vignette
1 parent db795a6 commit 6c4b7bc

7 files changed

Lines changed: 22 additions & 9 deletions

File tree

DESCRIPTION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ Suggests:
4545
knitr,
4646
nnet,
4747
rmarkdown,
48+
scales,
4849
spelling,
4950
testthat,
5051
tidyr

inst/WORDLIST

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Fienberg
1414
frac
1515
fulltime
1616
ggplot
17+
ggeffects
1718
gradeschool
1819
GSS
1920
https

vignettes/fig/wlf-alt-plot-1.png

-14.9 KB
Loading
-19.5 KB
Loading
-12.4 KB
Loading

vignettes/fig/wlf-plot-1.png

-15.3 KB
Loading

vignettes/nestedLogit.Rmd

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -459,10 +459,15 @@ various levels of the other predictors, and to compose these into a single figur
459459
#| fig.cap = "**plot method**: Predicted probabilities and 95 percent pointwise confidence envelopes of not working, working part-time, and working full-time",
460460
#| fig.show = "hold"
461461
op <- par(mfcol=c(1, 2), mar=c(4, 4, 3, 1) + 0.1)
462-
plot(wlf.nested, "hincome", list(children="absent"), # left panel
463-
xlab="Husband's Income", legend.location="top")
464-
plot(wlf.nested, "hincome", list(children="present"), # right panel
465-
xlab="Husband's Income", legend=FALSE)
462+
col <- scales::hue_pal()(3) # ggplot discrete colors
463+
plot(wlf.nested, "hincome", # left panel
464+
other = list(children="absent"),
465+
xlab = "Husband's Income",
466+
legend.location="top", col = col)
467+
plot(wlf.nested, "hincome", # right panel
468+
other = list(children="present"),
469+
xlab = "Husband's Income",
470+
legend=FALSE, col = col)
466471
par(op)
467472
```
468473

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

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

0 commit comments

Comments
 (0)