Hi @Georg_Semmler,
Here are two palettes available from other packages. The paletteer
package is very useful when trying to decide on a palette. Of course, there are many, many options; or you can make your own palette from scratch.
library(lattice)
library(rms)
#> Loading required package: Hmisc
#> Loading required package: survival
#> Loading required package: Formula
#> Loading required package: ggplot2
#>
#> Attaching package: 'Hmisc'
#> The following objects are masked from 'package:base':
#>
#> format.pval, units
#> Loading required package: SparseM
#>
#> Attaching package: 'SparseM'
#> The following object is masked from 'package:base':
#>
#> backsolve
library(RColorBrewer)
library(paletteer)
library(ggplot2)
# help("paletteer")
# as.data.frame(palettes_c_names)
my_colours <- paletteer_c("ggthemes::Classic Green", 16)
set.seed(1234)
df <- data.frame(
sex=factor(rep(c("0", "1"), each=200)),
weight=round(c(rnorm(200, mean=55, sd=5),
rnorm(200, mean=65, sd=5))),
height=round(c(rnorm(200, mean=160, sd=10),
rnorm(200, mean=170, sd=10)))
)
lm3 <- rms::Glm(sex ~ weight + height, data=df, family="binomial")
# Default
bplot(Predict(lm3,
weight=seq(40,100,by=2),
height=seq(150,200,by=5),
fun = function(x)1/(1+exp(-x))))
# Discrete palette from RColorBrewer (but has too few colors for scale required)
bplot(Predict(lm3,
weight=seq(40,100,by=2),
height=seq(150,200,by=5),
fun = function(x)1/(1+exp(-x))),
par.settings = list(regions = list(col=brewer.pal(9,"Set1"))))
# Sequential palette from ggthemes with 16 colors
bplot(Predict(lm3,
weight=seq(40,100,by=2),
height=seq(150,200,by=5),
fun = function(x)1/(1+exp(-x))),
par.settings = list(regions = list(col=my_colours)))
Created on 2021-09-13 by the reprex package (v2.0.1)