# Black & White Figures for Print Journals

#### 2023-08-17

This document shows examples how to create b/w figures, e.g. if you don’t want colored figures for print-journals.

## Barplots in grey-scaled colors

There are two ways to create plots in black and white or greyscale. For bar plots, geom.colors = "gs" creates a plot using a greyscale (based on scales::grey_pal()).

library(sjPlot)
library(sjmisc)
library(sjlabelled)
library(ggplot2)
theme_set(theme_bw())
data(efc)
plot_grpfrq(efc$e42dep, efc$c172code, geom.colors = "gs") ## Lineplots in b/w with different linetypes

Similar to barplots, lineplots - mostly from plot_model() - can be plotted in greyscale as well (with colors = "gs"). However, in most cases lines colored in greyscale are difficult to distinguish. In this case, plot_model() supports black & white figures with different linetypes. Use colors = "bw" to create a b/w-plot.

# create binrary response
y <- ifelse(efc$neg_c_7 < median(na.omit(efc$neg_c_7)), 0, 1)

# create data frame for fitting model
df <- data.frame(
y = to_factor(y),
sex = to_factor(efc$c161sex), dep = to_factor(efc$e42dep),
barthel = efc$barthtot, education = to_factor(efc$c172code)
)

# set variable label for response
set_label(df\$y) <- "High Negative Impact"

# fit model
fit <- glm(y ~., data = df, family = binomial(link = "logit"))

# plot marginal effects
plot_model(
fit,
type = "pred",
terms = c("barthel", "sex","dep"),
colors = "bw",
ci.lvl = NA
) Different linetypes do not apply to all linetyped plots, if these usually only plot a single line - so there’s no need for different linetypes, and you can just set colors = "black" (or colors = "bw").

# plot coefficients
plot_model(fit, colors = "black")
{"ft_lang_label":"__label__en","ft_lang_prob":0.6949273,"math_prob":0.97454953,"size":1358,"snap":"2023-40-2023-50","text_gpt3_token_len":391,"char_repetition_ratio":0.120384045,"word_repetition_ratio":0.0,"special_character_ratio":0.28792343,"punctuation_ratio":0.15019763,"nsfw_num_words":1,"has_unicode_error":false,"math_prob_llama3":0.9966609,"pos_list":[0,1,2,3,4,5,6],"im_url_duplicate_count":[null,null,null,null,null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-09-29T23:33:31Z\",\"WARC-Record-ID\":\"<urn:uuid:0669ea9e-2c9a-4060-b040-8f995ebe14b6>\",\"Content-Length\":\"55833\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:90a37b32-e7e1-4154-bfc2-eff3e374497e>\",\"WARC-Concurrent-To\":\"<urn:uuid:678bb692-2aab-46aa-bfe0-8adc5b5393a6>\",\"WARC-IP-Address\":\"137.222.10.189\",\"WARC-Target-URI\":\"http://www.stats.bris.ac.uk/R/web/packages/sjPlot/vignettes/blackwhitefigures.html\",\"WARC-Payload-Digest\":\"sha1:ZWTGDL3JNMYGUJXIC676XQJ4TTE6EXQU\",\"WARC-Block-Digest\":\"sha1:O2DFTMVCW7ZZZZHOADVT2XELSAAN6PBU\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-40/CC-MAIN-2023-40_segments_1695233510529.8_warc_CC-MAIN-20230929222230-20230930012230-00769.warc.gz\"}"}