【发布时间】:2018-10-04 08:59:33
【问题描述】:
我正在使用 sjPlot 的plot_model() 绘制回归模型。我想将我的线条颜色从 sjPlot 主题(红色和蓝色线条)更改为黑白或灰度。但是,当我使用 set_theme(theme_bw()) 时,绘图外观不会改变(theme_bw 来自 ggplot2,根据我在键入函数时看到的下拉菜单)。
但是,当我选择可用的 sjPlot 主题之一(theme_538、theme_blank、theme_sjplot 和 theme_sjplot2)时,情节外观确实发生了变化,这些主题都将线条呈现为红色和蓝色,但改变了情节背景,所以我认为我的功能是正确的。
如何使用 bw 或 gs 主题或手动将我的绘图的线条颜色设置为黑白?
library(ggplot2)
library(sjPlot)
library(sjmisc)
#set_theme(theme_bw()) # this does not change the plot appearance
set_theme(theme_538()) # this does change the plot background appearance
M <- glm(DV ~ IV1 + IV2 + IV3 + IV1*IV2*IV3, data = data5, family = quasibinomial("logit"))
p <- plot_model(M, type = "pred", terms = c("IV1", "IV2", "IV3 [-1,0,1]"), theme = theme_get())
p
ps:根据我在网上找到的 sjPlot 资源,可用的 sjPlot 主题应该比我看到的要多。这很奇怪。此外,我读到 set_theme() 函数应该与 ggplot2 主题一起使用,这似乎不是这里的情况。任何想法错误在哪里?也许我正在监督一些非常简单的事情?
编辑:我使用的是 R 版本 3.5.0 和 Rstudio 版本 1.1.383 谢谢!!
【问题讨论】:
标签: r ggplot2 colors themes sjplot