Comments (3)
Hi Daisy,
I was hoping to do the same. One workaround that I adapted from a similar issue on StackOverlow is to create a custom theme, then apply it to the plot object. An example I have just used successfully:
library(interactions)
library(lme4)
library(ggplot2)
theme_classic2 <- function(base_size = 12, base_family = ""){
theme_bw(base_size = base_size, base_family = base_family) %+replace%
theme(
legend.position = "none",
panel.border = element_blank(),
axis.line = element_line(colour = "black"),
panel.grid.major=element_line(colour="grey", size=0.5, 3),
panel.grid.major.x = element_blank(),
panel.grid.major.y = element_blank(),
panel.grid.minor = element_blank(),
panel.grid.minor.x = element_blank(),
panel.grid.minor.y = element_blank(),
strip.background = element_blank(),
legend.key = element_blank()
)
}
ft<-lmer(mpg ~ cyl*hp + (1|gear), data = mtcars)
plot<-interact_plot(ft, pred = cyl, modx = hp, interval = TRUE, plot.points = T, colors = "Set1",
point.size = 0.3, point.alpha = 0.1,)
plot+theme_classic2()
from interactions.
In fact, all you need to do is:
library(ggplot2)
interact_plot(model, predictor, moderator) +
theme(legend.position = "none")
This is using the theme options available in ggplot2
's theme()
function.
from interactions.
Hello Jacob, I have a question about changing the legend of geom_segment(). Specifically, I want to change the legend text from "Range of observed data" to something else. I used the code below, but it didn't work. Do you know other easy way to do so? I would really appreciate any ideas or suggestions you have. Thank you!
object <- johnson_neyman(model = fit, pred = Murder,
modx = Illiteracy)
object$plot + geom_segment(aes(x = 0.5, xend = 2.8, y = 10, yend = 10,
linetype = "range of moderate variable"),
lineend = "square", size = 1.25)
from interactions.
Related Issues (20)
- cannot change axis labels in sim_slopes HOT 2
- Create confidence interval around johnson-neyman point HOT 1
- mod2.labels issue HOT 1
- Interaction lines on top of data points
- Change Facet Labels in Mod2 HOT 1
- interact_plot with 3-way interaction error: contrasts can be applied only to factors with 2 or more levels HOT 1
- ymin and ymax are of different distance from the mean in cat_plot when used with glm.nb
- sim_slopes error HOT 1
- guidance on extensions
- Cat_plot converts numeric predictor variable to categorical without warning
- Corrigendum HOT 1
- Difference between "significant' and "not significant" is not itself statistically significant HOT 2
- point.shape not working in interact_plot()
- Change Legend Text
- Changing the x.label in Johnson Neyman plot using sim_slopes
- rlang strangeness with sim_slopes HOT 3
- latent interaction
- Change Confidence Interval in interact_plot HOT 1
- Issue with inclusion of "weights" HOT 5
- Ability to edit labels and grid for 3-way interaction jnplot
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from interactions.