user5613688
user5613688

Reputation: 43

sjPlot - Error: could not find function "sjp.setTheme"

I have been trying to explore using sjPlot but cannot get R to recognize the sjp.setTheme function. I have tried unloading and reloading all sjPlot packages and dependencies, together and seperately, but it doesn't seem to make a difference.

To clarify, sjPlot itself works fine, as I can develop a nice plot of my data, but I cannot modify any of the labels without sjp.setTheme

I have used the exact code indicated by strengeJacke as follows:

# load libraries
library(sjPlot)  # for plotting
library(sjmisc)  # for sample data
library(ggplot2) # to access ggplot-themes
# load sample data set
data(NestLand)
sjp.setTheme(geom.outline.color = "antiquewhite4", 
         geom.outline.size = 1, 
         geom.label.size = 2,
         geom.label.color = "grey50",
         title.color = "red", 
         title.size = 1.5, 
         axis.angle.x = 45, 
         axis.textcolor = "blue", 
         base = theme_bw())

Thanks in advance.

Upvotes: 1

Views: 1000

Answers (1)

Heikki
Heikki

Reputation: 2254

Seems like you have sjp version which is 2.4.0 or newer. From sjp 2.4.0 release notes you can see that:

The old set_theme() was removed. Instead, there are some new predifined themes available (see ?"sjPlot-themes"). The former sjp.setThemes() was renamed to set_theme() instead.

Thus, the following function works:

set_theme(geom.outline.color = "antiquewhite4", 
          geom.outline.size = 1, 
          geom.label.size = 2,
          geom.label.color = "grey50",
          title.color = "red", 
          title.size = 1.5, 
          axis.angle.x = 45, 
          axis.textcolor = "blue", 
          base = theme_bw())

Upvotes: 1

Related Questions