interactions icon indicating copy to clipboard operation
interactions copied to clipboard

point.shape not working in interact_plot()

Open ClaudiuPapasteri opened this issue 2 years ago • 0 comments

Hi. Thanks for the wonderful package. It seems that interact_plot() has an issue concerning point.shape argument. When used as intended, with point.shape = TRUE, nothing happens. Unfortunately, I couldn't find an easy fix using ggplot2 as, I am guessing, the shape_arg in interactions:::plot_mod_continuous() affects line geom and not point geom.

library(interactions) # dev version devtools::install_github("jacob-long/interactions")
library(ggplot2)

fiti <- lm(mpg ~ hp * wt, data = mtcars)

# No point shapes
interactions::interact_plot(fiti, pred = hp, modx = wt,
                            plot.points = TRUE, point.shape = TRUE, point.alpha = 0.6)


# Shape affects lines, but not points
interactions::interact_plot(fiti, pred = hp, modx = wt,
                            plot.points = TRUE, point.shape = TRUE, point.alpha = 0.6) +
geom_point(aes(shape = modx_group)) + 
scale_shape_manual(values = c(3, 16, 17))

Created on 2023-04-18 with reprex v2.0.2

ClaudiuPapasteri avatar Apr 18 '23 08:04 ClaudiuPapasteri