Skip to content

Change point shape using a variable not involved in the interaction #86

Description

@brianjosh

I am currently using your fabulous interactions package to visualise some statistical models I am running. I especially appreciate the interoperability with ggplot2. However, one thing I cannot work out how to do is change point shape by a variable that is not involved in the interaction. Specifically, I have a categorical variable with three levels in my model (as a random factor), and I would like the points to be shaped according to the levels of that factor. I'm sure this is quite a basic question, but I cannot work out how to use the point.shape argument to map to a factor not involved in the interaction, or to otherwise add a shape aesthetic to the graph. Any advice you can give would be hugely appreciated.

EXAMPLE:

My graph as it currently stands has the following code:

graph<- interact_plot(model1, pred="Mean_AlphaPhy",
modx = "Disturbance", plot.points=TRUE, partial.residuals = TRUE) +
scale_y_continuous(trans='log10') +
xlab("Mean Alpha Phylogenetic Diversity") + ylab("Number of plants colonising") +
scale_color_manual(values=c("#999999", "#E69F00")) +
scale_linetype_manual(values=c("solid", "solid")) +
theme_bw() + guides(linetype = "none") + theme(legend.position = "top") +
theme(axis.text=element_text(size=7),
axis.title=element_text(size=9),
legend.text=element_text(size=7),
legend.title=element_text(size=9))

And it is based on this model:

model1 <- glmmTMB(germ_num ~ Mean_AlphaPhy*Disturbance + propagule_pressure +
suitabilitypc1V2abs + suitabilitypc2V2abs + Density +
(1|Family) + (1|POWO.name) + (1|Site) + (1|Study),
family=nbinom2(link = "log"),
data=germinationcount)

I would like the graph to be exactly as it is, but with the points having one of three shapes, determined by the levels of 'Study'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions