jacob-long / jacob-long/interactions

point.shape not working in interact_plot()

Open
#68 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
R
Stars
135
Forks
19
PR merge metrics
No merged PRs in 30d

Description

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.

``` r
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)
```

![](https://i.imgur.com/zKp5EKp.png)

``` r

# 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))
```

![](https://i.imgur.com/Fw4lt5q.png)

Created on 2023-04-18 with [reprex v2.0.2](https://reprex.tidyverse.org)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the interact_plot() entry point and trace how it calls interactions:::plot_mod_continuous(), paying attention to the reported shape_arg handling and the point geom. Reproduce the provided mtcars example in R and confirm that point.shape = TRUE changes the plotted points while preserving the expected line behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.