Skip to content

Instantly share code, notes, and snippets.

@jvcasillas
Created April 26, 2020 21:36
Show Gist options
  • Save jvcasillas/31d8479ce58446abd1af5b199e1aba53 to your computer and use it in GitHub Desktop.
Save jvcasillas/31d8479ce58446abd1af5b199e1aba53 to your computer and use it in GitHub Desktop.
task_comp_plot <- task_comp %>%
mutate(., phon = fct_recode(phon, "/b/" = "b", "/d/" = "d", "/g/" = "g",
"/p/" = "p", "/t/" = "t", "/k/" = "k"),
phon = fct_relevel(phon, '/b/', '/d/', '/g/',
'/p/', '/t/', '/k/')) %>%
ggplot(., aes(x = phon, y = vot_scaled, group = task_sum)) +
geom_hline(yintercept = 0, lty = 3) +
stat_interval(aes(y = .prediction), data = task_preds,
position = position_dodge(0.5)) +
stat_pointinterval(aes(y = .value, fill = factor(task_sum)),
data = task_fits, .width = c(.80, .95),
position = position_dodge(1), show.legend = F) +
geom_point(aes(shape = factor(task_sum)), alpha = 0.1, size = 1,
position = position_dodge(0.5), fill = 'black') +
coord_cartesian(ylim = c(-2.5, 2.5)) +
scale_color_brewer() +
scale_fill_brewer(palette = "Set1") +
scale_shape_manual(name = '', values = c(21, 23),
labels = c("Delayed repetition", "Picture naming")) +
labs(y = "VOT (std. units)", x = "") +
my_theme(base_size = 13) +
theme(
legend.position = c(0.25, 0.95),
legend.direction = "horizontal",
legend.key = element_blank(),
legend.background = element_blank(),
legend.spacing.y = unit(-0.5, 'cm')) +
guides(shape = guide_legend(
override.aes = list(size = 3, alpha = 1,
fill = c("#E41A1C", "#377EB8"),
stroke = 1, color = 'black')))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment