2

I am trying to change the name of variable labels in a plot of random effects, but can't find a way. For a regular plot I would just use axis.labels but for type = re I can't find a way.

How can I change the text from "country(Intercept) and "knowledge_adj" to something else, like "pais(Intercept)" and "Conhecimento político"?

enter image description here

Code for creating data:

structure(list(country = c("Germany", "Brazil", "Czech Republic", 
"Brazil", "New Zealand", "Ireland", "Sweden", "Netherlands", 
"Germany", "Sweden", "Hungary", "Brazil", "Germany", "Hungary", 
"Ireland", "Germany", "Sweden", "Brazil", "Ireland", "Portugal", 
"Germany", "Brazil", "New Zealand", "New Zealand", "Ireland", 
"Brazil", "Brazil", "Netherlands", "Netherlands", "Ireland", 
"Portugal", "New Zealand", "Germany", "Brazil", "Germany", "Brazil", 
"Netherlands", "Germany", "Portugal", "Germany", "Sweden", "Brazil", 
"Ireland", "Brazil", "Brazil", "New Zealand", "Germany", "New Zealand", 
"Germany", "Ireland", "Germany", "Sweden", "Czech Republic", 
"Netherlands", "Ireland", "Netherlands", "Netherlands", "Ireland", 
"Germany", "Germany", "Brazil", "Germany", "Portugal", "Brazil", 
"Portugal", "New Zealand", "Brazil", "Brazil", "Ireland", "Germany", 
"Germany", "Ireland", "Portugal", "Brazil", "Germany", "Sweden", 
"Germany", "Brazil", "Germany", "Brazil", "Brazil", "Germany", 
"Germany", "Hungary", "Germany", "Ireland", "Portugal", "Portugal", 
"Germany", "Czech Republic", "Czech Republic", "Portugal", "Brazil", 
"Ireland", "New Zealand", "Brazil", "Netherlands", "Portugal", 
"Czech Republic", "Brazil", "Portugal", "New Zealand", "Germany", 
"Portugal", "New Zealand", "Ireland", "Germany", "Ireland", "New Zealand", 
"Czech Republic", "Brazil", "Hungary", "Brazil", "Netherlands", 
"New Zealand", "Brazil", "Sweden", "Hungary", "Netherlands", 
"New Zealand", "Germany", "Ireland", "Portugal", "Hungary", "Netherlands", 
"Portugal", "Germany", "Germany", "Brazil", "Netherlands", "Hungary", 
"Hungary", "Ireland", "Czech Republic", "Sweden", "Ireland", 
"Netherlands", "Germany", "Germany", "Ireland", "Czech Republic", 
"Germany", "New Zealand", "Netherlands", "Germany", "Ireland", 
"Germany", "Brazil", "Germany", "Netherlands", "Ireland", "Ireland", 
"Ireland", "Hungary", "Brazil", "Portugal", "Sweden", "Brazil", 
"New Zealand", "Germany", "Germany", "Czech Republic", "Germany", 
"Sweden", "Portugal", "Brazil", "Netherlands", "Ireland", "Brazil", 
"Portugal", "New Zealand", "Czech Republic", "Sweden", "Netherlands", 
"Netherlands", "Germany", "Sweden", "Brazil", "Germany", "Germany", 
"Brazil", "Germany", "Ireland", "Netherlands", "Netherlands", 
"Germany", "Netherlands", "Germany", "Ireland", "Netherlands", 
"Brazil", "Sweden", "Sweden", "New Zealand", "Germany", "Brazil", 
"Portugal", "Portugal", "Brazil", "Czech Republic", "Netherlands", 
"Germany", "Brazil", "Germany", "Netherlands", "Brazil", "Czech Republic", 
"Germany", "Netherlands", "Hungary", "Netherlands", "Portugal", 
"Germany", "New Zealand", "Germany", "Brazil", "Brazil", "Germany", 
"Ireland", "Portugal", "Czech Republic", "Brazil", "Brazil", 
"Portugal", "Brazil", "Brazil", "Netherlands", "Germany", "Brazil", 
"Ireland", "New Zealand", "Germany", "Germany", "Portugal", "Sweden", 
"Hungary", "Netherlands", "Netherlands", "Netherlands", "Netherlands", 
"New Zealand", "Germany", "Germany", "Portugal", "Portugal", 
"Sweden", "New Zealand", "Brazil", "Brazil", "Portugal", "Netherlands", 
"Hungary", "Portugal", "Ireland", "Germany", "Brazil", "Portugal", 
"Ireland", "Germany", "Czech Republic", "Ireland", "Hungary", 
"Netherlands", "Germany", "Portugal", "Germany", "Sweden", "Germany", 
"Czech Republic", "Portugal", "Germany", "Sweden", "Sweden", 
"Hungary", "New Zealand", "Czech Republic", "Hungary", "Germany", 
"Brazil", "Germany", "Brazil", "Portugal", "New Zealand", "Germany", 
"Czech Republic", "New Zealand", "Ireland", "Germany", "Germany", 
"Germany", "Czech Republic", "Ireland", "Brazil", "Czech Republic", 
"Germany", "Germany", "Brazil", "Portugal", "Brazil", "Hungary", 
"Netherlands", "Portugal", "New Zealand", "Portugal", "Brazil", 
"New Zealand", "Czech Republic", "Sweden", "Czech Republic", 
"New Zealand", "Germany", "Ireland", "Czech Republic", "Portugal", 
"Portugal", "Germany", "Netherlands", "Portugal", "Ireland", 
"Brazil", "Germany", "Brazil", "Portugal", "Sweden", "Czech Republic", 
"Ireland", "New Zealand", "Sweden", "New Zealand", "Hungary", 
"Brazil", "Netherlands", "Ireland", "Brazil", "Germany", "Brazil", 
"New Zealand", "Germany", "Ireland", "Ireland", "Brazil", "Brazil", 
"Ireland", "Brazil", "Sweden", "Ireland", "Brazil", "Ireland", 
"New Zealand", "Ireland", "New Zealand", "Germany", "Sweden", 
"Germany", "Brazil", "Germany", "Netherlands", "Ireland", "New Zealand", 
"Brazil", "Germany", "Germany", "New Zealand", "Sweden", "Hungary", 
"Netherlands", "New Zealand", "Ireland", "Netherlands", "Ireland", 
"Portugal", "Germany", "New Zealand", "Hungary", "New Zealand", 
"Czech Republic", "Netherlands", "Portugal", "New Zealand", "Germany", 
"Ireland", "Ireland", "New Zealand", "Sweden", "Czech Republic", 
"Brazil", "Brazil", "New Zealand", "Brazil", "Germany", "Brazil", 
"Germany", "Sweden", "Portugal", "Germany", "Germany", "Netherlands", 
"New Zealand", "Netherlands", "Germany", "Czech Republic", "Brazil", 
"Germany", "Germany", "Netherlands", "Germany", "Portugal", "Ireland", 
"Sweden", "New Zealand", "Portugal", "Sweden", "Portugal", "New Zealand", 
"Hungary", "Ireland", "Sweden", "New Zealand", "New Zealand", 
"Brazil", "Brazil", "Brazil", "Brazil", "Czech Republic", "Germany", 
"Sweden", "Germany", "Brazil", "Hungary", "Germany", "Germany", 
"Ireland", "New Zealand", "Sweden", "Ireland", "Germany", "Ireland", 
"Germany", "Hungary", "Germany", "Brazil", "Ireland", "Ireland", 
"Brazil", "Ireland", "Czech Republic", "Germany", "Germany", 
"Germany", "Germany", "Germany", "Germany", "Germany", "Ireland", 
"Ireland", "Hungary", "Brazil", "Brazil", "Germany", "New Zealand", 
"Ireland", "Ireland", "Czech Republic", "Portugal", "Ireland", 
"Netherlands", "Portugal", "Germany", "Brazil", "Ireland", "Ireland", 
"Sweden", "Brazil", "Germany", "New Zealand", "Sweden", "Ireland", 
"Germany", "Ireland", "Sweden", "Germany", "New Zealand", "Netherlands", 
"Sweden", "Netherlands", "Germany", "Czech Republic", "Brazil", 
"Netherlands", "Ireland", "Ireland", "Germany", "Germany", "Brazil", 
"Netherlands", "Germany", "Germany", "Portugal", "Brazil", "Germany", 
"Brazil", "Ireland", "Hungary", "Sweden", "New Zealand", "Germany", 
"Germany", "Brazil", "Brazil", "Brazil", "Brazil", "Brazil", 
"Czech Republic", "New Zealand", "New Zealand", "Germany", "Germany", 
"Ireland", "New Zealand", "Sweden", "Ireland", "Germany", "New Zealand", 
"Germany", "Ireland", "New Zealand", "Netherlands", "Ireland", 
"Brazil", "Germany", "New Zealand", "Sweden", "Brazil", "Germany", 
"Portugal", "Netherlands", "Hungary", "Germany", "Brazil", "Portugal", 
"Netherlands", "Brazil", "Portugal", "Germany", "Hungary", "Portugal", 
"New Zealand", "Ireland", "Brazil", "Germany", "Czech Republic", 
"Portugal", "Hungary", "Germany", "New Zealand", "Ireland", "New Zealand", 
"Germany", "Sweden", "Czech Republic", "Germany", "Germany", 
"Netherlands", "Portugal", "Germany", "Ireland", "Germany", "Germany", 
"New Zealand", "Czech Republic", "New Zealand", "Brazil", "Portugal", 
"Brazil", "Hungary", "Czech Republic", "Germany", "Ireland", 
"New Zealand", "Brazil", "Portugal", "Czech Republic", "Brazil", 
"Germany", "New Zealand", "Germany", "Brazil", "Hungary", "Hungary", 
"Hungary", "New Zealand", "Ireland", "Brazil", "Czech Republic", 
"Germany", "Czech Republic", "Czech Republic", "Portugal", "Hungary", 
"Germany", "Netherlands", "Brazil", "New Zealand", "Ireland", 
"Sweden", "Germany", "Portugal", "Portugal", "Hungary", "Germany", 
"Ireland", "Hungary", "Portugal", "Germany", "Sweden", "Ireland", 
"Ireland", "Germany", "Brazil", "Ireland", "Czech Republic", 
"Portugal", "Netherlands", "Netherlands", "Ireland", "Portugal", 
"Sweden", "Brazil", "Portugal", "Netherlands", "Germany", "Germany", 
"Czech Republic", "Portugal", "New Zealand", "Ireland", "Ireland", 
"Portugal", "Germany", "Hungary", "Germany", "Brazil", "Ireland", 
"Germany", "Ireland", "Germany", "Netherlands", "Hungary", "Sweden", 
"Germany", "Germany", "Germany", "Netherlands", "Brazil", "Portugal", 
"Brazil", "Portugal", "Brazil", "Portugal", "Ireland", "Brazil", 
"Portugal", "Ireland", "Ireland", "Netherlands", "Ireland", "Germany", 
"Sweden", "Ireland", "Netherlands", "Ireland", "Ireland", "Brazil", 
"New Zealand", "Germany", "Germany", "Hungary", "New Zealand", 
"Hungary", "Netherlands", "New Zealand", "Portugal", "Brazil", 
"Brazil", "Ireland", "Brazil", "Ireland", "Germany", "Czech Republic", 
"Portugal", "Ireland", "Brazil", "Ireland", "Germany", "Germany", 
"New Zealand", "New Zealand", "Germany", "Portugal", "Ireland", 
"Netherlands", "Sweden", "Czech Republic", "Netherlands", "New Zealand", 
"Ireland", "Germany", "Ireland", "Brazil", "Germany", "Germany", 
"Hungary", "Germany", "Ireland", "Germany", "Hungary", "Germany", 
"Ireland", "Brazil", "Ireland", "Germany", "Hungary", "Brazil", 
"Ireland", "Ireland", "Germany", "Portugal", "Germany", "Portugal", 
"Germany", "Brazil", "New Zealand", "Czech Republic", "Ireland", 
"Brazil", "Hungary", "Hungary", "Germany", "Germany", "Portugal", 
"Germany", "Germany", "New Zealand", "Hungary", "Netherlands", 
"Portugal", "Brazil", "Portugal", "Germany", "Ireland", "Germany", 
"New Zealand", "Brazil", "Sweden", "Ireland", "Germany", "New Zealand", 
"Netherlands", "New Zealand", "Brazil", "Germany", "Hungary", 
"Ireland", "Ireland", "Brazil", "Czech Republic", "Sweden", "Sweden", 
"Netherlands", "Germany", "Netherlands", "Netherlands", "Ireland", 
"Hungary", "New Zealand", "New Zealand", "Ireland", "Sweden", 
"Ireland", "Hungary", "Ireland", "Portugal", "Brazil", "Ireland", 
"Germany", "Hungary", "Brazil", "Sweden", "Germany", "Hungary", 
"Brazil", "Germany", "Germany", "Portugal", "Germany", "Brazil", 
"Netherlands", "Netherlands", "Hungary", "Sweden", "Ireland", 
"Germany", "Ireland", "Czech Republic", "Brazil", "Germany", 
"Hungary", "Sweden", "New Zealand", "Ireland", "Netherlands", 
"Sweden", "Ireland", "Brazil", "Czech Republic", "Netherlands", 
"Brazil", "New Zealand", "Sweden", "Germany", "New Zealand", 
"Brazil", "Ireland", "Germany", "Netherlands", "Portugal", "Germany", 
"New Zealand", "Ireland", "Sweden", "Germany", "Portugal", "Portugal", 
"Portugal", "Brazil", "New Zealand", "Ireland", "Brazil", "New Zealand", 
"New Zealand", "Ireland", "Brazil", "New Zealand", "Brazil", 
"Czech Republic", "Czech Republic", "Brazil", "Germany", "Brazil", 
"Portugal"), exp_cong_LH_all = c(NA, NA, NA, NA, 0, 0, -3, -1, 
-6.5, -2, NA, -5, -4, NA, -1, NA, -2, NA, NA, -1, 0, NA, NA, 
-2, NA, NA, NA, -1, -2, -1, NA, NA, -3, NA, NA, -6, -3, NA, -2, 
-2, NA, NA, -2, -1, NA, NA, 0, NA, -1.5, -2, -1, -2, -1, -1, 
-4, -1, -2, NA, -1.5, -3, NA, -1, NA, NA, -3, 0, NA, -5, 0, NA, 
NA, NA, -3, NA, -1, NA, -1, 0, -1, NA, -6, NA, -1, -1, NA, -2, 
-1, 0, -0.5, NA, 0, -2, -2, -2, 0, NA, -2, -1, NA, NA, -1, -1.5, 
0, -1, NA, NA, NA, -1, -3, NA, NA, -2, 0, -2, -2, NA, -1, NA, 
-2, -2, NA, NA, NA, NA, -1, NA, NA, NA, NA, -2, -1, 0, -1, -2, 
-2, -1, -1, -2, -2, -2, NA, NA, -0.5, -1, NA, NA, NA, NA, -0.5, 
-2, -1, NA, -4, -3, -7, -2, -2, NA, -2, NA, -3, NA, -2, 0, -3, 
NA, -2, -1, NA, NA, NA, NA, -2, NA, 0, -2, 0, NA, -2, NA, NA, 
0, -2, -2, 0, -1, -2, -2, -1, 0, NA, -1, -2, NA, -2, NA, NA, 
NA, NA, NA, 0, -1, NA, -0.5, -3, -6, NA, -0.5, -2, 0, 0, NA, 
-2, -1, -2, NA, NA, NA, -1, 0, -1, NA, -1, NA, NA, NA, -1, -1, 
NA, NA, -2, -1, NA, NA, -1, -1, -3, 0, -1, 0, -1.5, -1, -1, NA, 
-1, -1, -3, NA, NA, NA, -1, 0, NA, -1, -1, NA, NA, NA, NA, NA, 
NA, 0, -3, NA, -1, 0, -2, NA, NA, -1, -1, 0, -2, NA, -3, 0, 0, 
NA, NA, -1, NA, -1, -1, 0, NA, NA, -1, -3, NA, NA, NA, NA, NA, 
NA, NA, NA, NA, NA, NA, -2, -1, -3, NA, NA, NA, -1, NA, -3, 0, 
NA, -5, -1, NA, -1, 0, -2, -3, -1, -1, NA, -1, NA, -4, -1, NA, 
-1, -2, -3, -2, NA, NA, 0, -1, NA, -1.5, NA, -1.5, -1, 0, NA, 
NA, NA, -4, -2, -2, NA, NA, -1, -1.5, -3, NA, NA, 0, NA, NA, 
-2, -1, NA, NA, NA, 0, NA, -1, NA, NA, -5, NA, -1, -1, NA, 0, 
NA, -1, 0, -1, NA, -1, -2, NA, -1, NA, -1, NA, -3, -1, NA, NA, 
-1, NA, -2, -6, NA, -1, NA, -1, 0, -2, NA, -1, -1, 0, NA, -1.5, 
-2.5, -1, 0, 0, NA, -3, -2, NA, -4, -1, -4, NA, -2, NA, NA, 0, 
NA, NA, NA, -6, -1, -3, NA, NA, NA, -3, 0, -0.5, -1, -1, -2, 
NA, -2, -8, -1.5, NA, NA, NA, NA, -1, NA, NA, NA, -2, NA, -2, 
-0.5, 0, NA, NA, NA, 0, NA, NA, -4, -0.5, -2.5, -1, -1, 0, -1, 
-4, -2, NA, NA, NA, -2, NA, -1, NA, 0, -1, -1, -1, NA, NA, -2, 
NA, NA, NA, -3, -3, -2, NA, NA, -2, -1, NA, -2, -1, NA, -3, -3, 
NA, -1, NA, -3, NA, NA, 0, -2, -2, -1, 0, NA, NA, NA, NA, -1, 
NA, NA, NA, -2.5, NA, -1, -2, -2, 0, NA, 0, NA, NA, -0.5, -2, 
NA, NA, NA, -1, -1, NA, -1, -1, -1, -5, 0, NA, -1, -1, 0, -1, 
NA, -2, NA, -3, NA, NA, -3.5, NA, NA, 0, NA, NA, -1, NA, NA, 
-1, -1, -1, -1.5, -2, NA, -3, NA, NA, NA, NA, NA, NA, NA, NA, 
NA, NA, 0, NA, NA, NA, NA, NA, -1, -2, NA, NA, NA, NA, NA, NA, 
NA, -1, -1, NA, NA, -1, NA, NA, NA, NA, NA, -1, NA, -1, -1, -2, 
-2, -2, -1, NA, -1, -1, -1, NA, NA, NA, -1, -1, 0, NA, -2, NA, 
-1, -2, NA, NA, -1, 0, -5, NA, -2, NA, -2, -2, NA, NA, NA, -1, 
-3, -1, NA, NA, NA, -1, -0.5, NA, NA, -2, -3, -1, -0.5, NA, -4, 
0, -1, -2, NA, NA, NA, -1, 0, NA, NA, -1, -2, -3, 0, -2, NA, 
NA, -1, -1, NA, NA, 0, 0, NA, -2, -4, NA, -2, NA, -3, -1, NA, 
-1, NA, -1, NA, NA, NA, NA, -2, 0, NA, -2, NA, NA, NA, -1, -4, 
NA, 0, NA, NA, -3, NA, NA, -2, NA, -4, -1, -2, -1, NA, NA, NA, 
-1.5, NA, 0, -1, NA, NA, NA, -1, -1, NA, -1, -2, -4, -3, NA, 
-3, NA, -2, NA, NA, -4, 0, 0, NA, 0, -1, NA, NA, -1, 0, NA, NA, 
0, NA, NA, NA, NA, -1, NA, 0, NA, -2, -1, NA, NA, NA, -2, -1, 
NA, NA, NA, 0, -1, -0.5, -3, -2, -1, -2, -1, -2, -2, 0, -3, NA, 
NA, NA, -2, NA, -0.5, NA, -7, -2, -1, NA, NA, NA, -1, -2, 0, 
-3, 0, -1, -1, -2, -1, NA, -1, NA, -3, 0, -1, -2, -6, -1, NA, 
-1, -2, NA, -2, -3, NA, NA, NA, NA, -3, NA, -2, 0, -3, 0, -3, 
-2, -3, NA, -1.5, NA, NA, NA, NA, -2, -4, NA, 0, -1, NA, NA, 
-1, NA, NA, -2, -2, NA, NA, NA), knowledge_adj = c(0.333333333333333, 
0.666666666666667, 0.666666666666667, 0, 0.333333333333333, 0.666666666666667, 
0.333333333333333, 0.666666666666667, 0, 0.666666666666667, 0, 
0, 0.333333333333333, 0.666666666666667, 0.666666666666667, 0.666666666666667, 
NaN, 0.666666666666667, 1, 0.666666666666667, NaN, 0.666666666666667, 
0.333333333333333, 0.666666666666667, 0.666666666666667, 1, 0.333333333333333, 
1, 0.666666666666667, 0.666666666666667, 0.333333333333333, 0, 
0, 0, 0, 1, 0.333333333333333, 0.333333333333333, 0.333333333333333, 
0.333333333333333, 0, 0.666666666666667, 0.666666666666667, 0.333333333333333, 
0.333333333333333, 0, 0.666666666666667, 1, 0, 1, 0.666666666666667, 
1, 0.333333333333333, 0.333333333333333, 0.333333333333333, 0, 
0, 0.666666666666667, 0.333333333333333, NaN, 0.333333333333333, 
0.333333333333333, 0.333333333333333, 0, 0, 0.666666666666667, 
0.666666666666667, 0.666666666666667, 0.666666666666667, 0.666666666666667, 
0, 0.333333333333333, 0.333333333333333, 0.666666666666667, NaN, 
0, 0.666666666666667, 0.666666666666667, NaN, 0, 0.333333333333333, 
0.666666666666667, 0, 0, 0.333333333333333, 0.333333333333333, 
0.333333333333333, 0.666666666666667, 0.333333333333333, 1, 0.666666666666667, 
0.666666666666667, 0.333333333333333, 0.666666666666667, 1, 0, 
0.333333333333333, 0.333333333333333, 0.666666666666667, 0, 0.666666666666667, 
1, 0.666666666666667, 1, 0.666666666666667, 0.666666666666667, 
NaN, 1, 0.333333333333333, 0, 0.666666666666667, 0, 1, 1, 1, 
0.333333333333333, 0.666666666666667, 0.333333333333333, 1, 0.666666666666667, 
NaN, 0.666666666666667, 0.333333333333333, 0, 0.666666666666667, 
0, 0, 0, 0.333333333333333, 0, 0.666666666666667, 1, 1, 0.666666666666667, 
1, 0.666666666666667, 0, 0, NaN, 1, 0.333333333333333, 0.666666666666667, 
0.333333333333333, 0.666666666666667, 0.333333333333333, 0.333333333333333, 
0.666666666666667, 0.666666666666667, NaN, 1, 0.666666666666667, 
0, 0.666666666666667, 0.333333333333333, 0.666666666666667, 0, 
0.333333333333333, 1, 0.666666666666667, 0, 0.666666666666667, 
0, NaN, 0.333333333333333, 1, 1, 0.333333333333333, 0, 0.666666666666667, 
0, 0.666666666666667, 0.333333333333333, 0.333333333333333, 0, 
1, NaN, 0.333333333333333, 0, 0, NaN, 0, NaN, 0.333333333333333, 
1, 0, 0, 0, NaN, 1, 0.666666666666667, 0.333333333333333, 0.333333333333333, 
NaN, 0.5, 0.333333333333333, 0.666666666666667, 0.333333333333333, 
0.333333333333333, 0.333333333333333, 0.666666666666667, 0.666666666666667, 
0.666666666666667, 0, 0, 0, 0.666666666666667, 0.666666666666667, 
0.666666666666667, 0.333333333333333, 0.666666666666667, 0.333333333333333, 
0, NaN, 0.5, 0, 0.333333333333333, 0, 0.666666666666667, 0.666666666666667, 
1, 1, 0.666666666666667, 0.666666666666667, 0.333333333333333, 
1, 0.333333333333333, 0.333333333333333, 0.666666666666667, 0, 
1, 0, NaN, NaN, 0.333333333333333, 0, 0.333333333333333, 0.333333333333333, 
0.666666666666667, 1, 0.333333333333333, 0.333333333333333, NaN, 
0.666666666666667, 0.333333333333333, 0.666666666666667, 0.666666666666667, 
1, 0.333333333333333, 0, 0, 0.666666666666667, 1, 0, 0.666666666666667, 
0.333333333333333, 1, 0, 1, 0.333333333333333, 0.666666666666667, 
0.333333333333333, 0.333333333333333, 1, 0, 1, 1, 0.333333333333333, 
NaN, 1, 0.666666666666667, 1, NaN, 0, 0, 0.666666666666667, 0.666666666666667, 
0.333333333333333, 0.333333333333333, 0.666666666666667, 0.666666666666667, 
0, 1, 0.333333333333333, 0.333333333333333, 0.666666666666667, 
0.5, 1, 0.333333333333333, NaN, NaN, 0.333333333333333, 0, 0.333333333333333, 
0.666666666666667, NaN, NaN, 0, 0, 0.333333333333333, 0.666666666666667, 
0.666666666666667, 0.333333333333333, 0.333333333333333, 0.333333333333333, 
0.333333333333333, 0.333333333333333, 0.333333333333333, 0.333333333333333, 
1, 0.333333333333333, NaN, 0.333333333333333, 0.666666666666667, 
0, 1, 0.333333333333333, 0.333333333333333, 0.333333333333333, 
1, 0.666666666666667, 0.666666666666667, 0, 0.333333333333333, 
0.333333333333333, 0.666666666666667, 0.666666666666667, 0.333333333333333, 
0.666666666666667, 0.666666666666667, 0.333333333333333, 0.333333333333333, 
0.666666666666667, 1, 1, 0.333333333333333, 0.666666666666667, 
1, NaN, 0.666666666666667, 0.666666666666667, 1, 1, 0.666666666666667, 
0.333333333333333, 0.333333333333333, 0.333333333333333, 0.666666666666667, 
1, 0, 0.666666666666667, 1, 0, 0.666666666666667, NaN, 0.333333333333333, 
NaN, 0.666666666666667, 0, NaN, 1, NaN, 1, 1, 0, 0, 1, 0.5, 1, 
0, 0.333333333333333, 0, NaN, 1, 0.666666666666667, 1, 0, 1, 
0.666666666666667, 0.666666666666667, NaN, 0.333333333333333, 
0.666666666666667, 0.666666666666667, 1, 0.333333333333333, 0, 
0, 0.666666666666667, 0, 0.333333333333333, 0.333333333333333, 
NaN, 1, 0.333333333333333, NaN, 0.333333333333333, 0.666666666666667, 
0, 0.666666666666667, 0.333333333333333, 0.333333333333333, 0.333333333333333, 
0.666666666666667, 0.333333333333333, 0, 0, 0.333333333333333, 
0.333333333333333, 0.333333333333333, 0.333333333333333, 0.666666666666667, 
0.666666666666667, 0, 1, 0, 1, 0, 0.5, 0.666666666666667, 0, 
0.333333333333333, 0.666666666666667, 0.666666666666667, 0.5, 
0, 0.666666666666667, 0.333333333333333, 0.666666666666667, 0.333333333333333, 
NaN, 1, 1, 0.5, 1, 0.666666666666667, NaN, 0.666666666666667, 
0.666666666666667, 0.333333333333333, 0.666666666666667, 0, 0.666666666666667, 
1, 1, 0.666666666666667, 1, 0, 0.333333333333333, 0.666666666666667, 
NaN, NaN, 0.666666666666667, 0.666666666666667, 0.333333333333333, 
1, 1, 0.333333333333333, 1, 0.333333333333333, 1, 1, 0.666666666666667, 
0.666666666666667, 0.333333333333333, 0.666666666666667, 1, 0.666666666666667, 
0, 0.666666666666667, 0.333333333333333, 0.666666666666667, 0.333333333333333, 
0, NaN, 1, 0.666666666666667, 1, 0, 0.333333333333333, 0.333333333333333, 
1, 0.666666666666667, 0, 0.333333333333333, 0.666666666666667, 
NaN, 0.666666666666667, 1, 0.333333333333333, 1, 0.666666666666667, 
0, 0.333333333333333, 0.333333333333333, 0.666666666666667, NaN, 
NaN, 1, 0, 0.333333333333333, 0.666666666666667, 0, 0.666666666666667, 
0.666666666666667, 0.666666666666667, 0, 0.333333333333333, 0.666666666666667, 
0.333333333333333, 1, 1, 1, 0.666666666666667, 0, 0.666666666666667, 
NaN, NaN, 0.666666666666667, 0, 0, 1, 0.666666666666667, 1, NaN, 
0.333333333333333, 0.666666666666667, 0, 1, 0, 0.666666666666667, 
1, 1, 0, NaN, 0, 0, 0.333333333333333, 0.333333333333333, 0.666666666666667, 
0.333333333333333, 0.666666666666667, 0.333333333333333, 0.666666666666667, 
NaN, 0.666666666666667, 1, 0.333333333333333, 1, 0.666666666666667, 
0.333333333333333, 1, 0.333333333333333, 0.666666666666667, 0.333333333333333, 
NaN, 0.666666666666667, 1, 0, 0.666666666666667, 0.666666666666667, 
NaN, 0.333333333333333, 0, 0.666666666666667, NaN, 0.333333333333333, 
NaN, 0.666666666666667, 0, 1, 1, 0, 0.666666666666667, 0.333333333333333, 
0.333333333333333, 0.666666666666667, 0, 0.333333333333333, 0.5, 
0.333333333333333, 0.333333333333333, 1, 1, NaN, 1, NaN, 0.666666666666667, 
0.333333333333333, 0.333333333333333, 0.333333333333333, 0, 0.666666666666667, 
1, 0.666666666666667, 0.666666666666667, 1, 0.333333333333333, 
0.333333333333333, 0, NaN, 0, 0.666666666666667, 1, 0.333333333333333, 
0.666666666666667, 0, 0.333333333333333, 1, 0.333333333333333, 
0.333333333333333, 0.666666666666667, 0.666666666666667, 1, 0.333333333333333, 
NaN, 1, 1, 0, 0.666666666666667, 0.666666666666667, 0, 0.333333333333333, 
0, 0, 0.666666666666667, 0.666666666666667, 0.666666666666667, 
0.333333333333333, 0, 0.666666666666667, 0.666666666666667, 0.333333333333333, 
1, 0, 0, 1, 1, 0.333333333333333, 0.333333333333333, 0.333333333333333, 
0, 0.666666666666667, 0.666666666666667, 0.333333333333333, 1, 
NaN, 0, 0.666666666666667, 0.666666666666667, 0.666666666666667, 
0, 0.333333333333333, 0.333333333333333, 0.666666666666667, 0.333333333333333, 
0, 0.666666666666667, 1, 0.666666666666667, 1, 0, 0.333333333333333, 
0.666666666666667, 1, 0, 0.333333333333333, NaN, 0.666666666666667, 
0.666666666666667, 1, 1, 1, 0, 0, NaN, NaN, 0.333333333333333, 
0.333333333333333, 0.333333333333333, 1, 1, 0.666666666666667, 
0.333333333333333, 0, 0.333333333333333, 1, 1, 0, 1, 1, 0.333333333333333, 
0, 1, 0, 0.666666666666667, 0.666666666666667, 0.666666666666667, 
0.333333333333333, 0.666666666666667, 0.333333333333333, 0, 1, 
0.333333333333333, 0, 1, 0.666666666666667, 0.333333333333333, 
1, 0.333333333333333, NaN, 0.333333333333333, 0.333333333333333, 
0.333333333333333, 0.333333333333333, 0.666666666666667, 0, NaN, 
0.333333333333333, 0.666666666666667, 1, 0.666666666666667, 0.333333333333333, 
1, 1, 0, NaN, 0, NaN, 1, 0.333333333333333, 0.666666666666667, 
0, 0.666666666666667, 1, 1, 0, 0, 0.666666666666667, 0.333333333333333, 
0.333333333333333, NaN, 0.666666666666667, 0.666666666666667, 
0, 1, 0.333333333333333, 1, 0, 0.666666666666667, 0.333333333333333, 
NaN, 0.666666666666667, 0.666666666666667, 1, 0.333333333333333, 
NaN, 0.666666666666667, 1, 0.666666666666667, 1, NaN, 0, 0.666666666666667, 
0.666666666666667, 0, 0, 0, 1, 0.333333333333333, 0.333333333333333, 
1, 0.666666666666667, 0.333333333333333, 0.666666666666667, 0.5, 
1, 0.333333333333333, 1, 1, 0, 0.666666666666667, 0.333333333333333, 
0.666666666666667, 1, 0.666666666666667, 0.333333333333333, 0.333333333333333, 
1, 0, 1, 0.666666666666667, NaN, 0.333333333333333, 0.666666666666667, 
0.666666666666667, 1, 0.333333333333333, 0.333333333333333, 0.666666666666667, 
NaN, 1, 0.666666666666667, 0.666666666666667, 0.333333333333333, 
0.666666666666667, 0.666666666666667, 0.333333333333333, NaN, 
0.666666666666667, 1, 0, 0, 1, 0.333333333333333, 1, 1, 0.333333333333333, 
0.666666666666667, 0.666666666666667, NaN, 0.5, 0.666666666666667, 
0.666666666666667, 1, 1, 0.333333333333333, 0, 1, 1, 0, NaN, 
0.666666666666667, 0, 0.333333333333333, 0.666666666666667, 0, 
1, 0.333333333333333, 0.666666666666667, 0.666666666666667, 0.666666666666667, 
0.666666666666667, 0.333333333333333, 0.333333333333333, 1, 0.666666666666667, 
0.666666666666667, NaN, 0.333333333333333, 0.666666666666667)), row.names = c(NA, 
-850L), class = "data.frame")

Regression and plot:

library(sjPlot)
VS1 <- lmerTest::lmer(exp_cong_LH_all ~ knowledge_adj + (1 + knowledge_adj|country), data = df)

plot_model(VS1, type = "re") +
  scale_color_sjplot("eight") 

1 Answers1

3

Perhaps there are better ways, but here is something to consider that might help.

First, store your plot_model result (a ggplot) as pm.

pm <- plot_model(VS1, type = "re") +
        scale_color_sjplot("eight") 

You will see that pm$data$facet stores the labels of interest:

pm$data$facet

 [1] "country (Intercept)" "country (Intercept)" "country (Intercept)" "country (Intercept)" "country (Intercept)"
 [6] "country (Intercept)" "country (Intercept)" "country (Intercept)" "country (Intercept)" "knowledge_adj"      
[11] "knowledge_adj"       "knowledge_adj"       "knowledge_adj"       "knowledge_adj"       "knowledge_adj"      
[16] "knowledge_adj"       "knowledge_adj"       "knowledge_adj"

You can convert to a factor, and note the levels will include these labels:

pm$data$facet <- factor(pm$data$facet)
levels(pm$data$facet)

[1] "country (Intercept)" "knowledge_adj" 

Change the levels to your new labels and plot:

levels(pm$data$facet) <- c("pais(Intercept)", "Conhecimento político")
pm

Plot

plot with new labels for facets

Ben
  • 28,684
  • 5
  • 23
  • 45
  • Hi Ben, I followed your answer (using `levels(plot_fil_zi_nbin_off_scaled$data$group_col)` as I think `$facet` doesn't exist anymore), but now I get `Error in palette(): ! Insufficient values in manual scale. 12 needed but only 6 provided`. However, my levels are 6... – LT17 Jun 19 '23 at 14:12
  • @LT17 Were you able to reproduce the example above with the data provided? I reran the code and it still seemed to work. It might be worthwhile to post again on SO, providing some example data you have, and include the code to create the plot as well. – Ben Jun 19 '23 at 15:59
  • Hi Ben, yes, I was able to re-run the code in the question. Perhaps the issue may be that I used `glmmTMB` and I want to plot the predicted responses (`type = "pred"`) and not the random effects. I thought the code would work anyways. I will search on SO if someone else had a similar issue, otherwise I'll create a new question. Thanks! – LT17 Jun 20 '23 at 11:24