I am trying to plot 2 lines with errorbars over 3 points. Points are marked with shape and fill. Basically, the graph should look like that one.
Without changing the labels of the legend, I succeeded and graph is almost perfect. However, I do want to change legend labels and when I try this, I can't make it work.
After setting style of points manually (fill and shape), I use scale_shape_discrete
to set the labels, but get following warning: "Scale for 'shape' is already present. Adding another scale for 'shape', which will replace the existing scale."
The product then has two legends (once the old and once the new one), but also the elements in the plot are reset (no fill information any more).
I followed the instructions on this tutorial to avoid having multiple legends. However, the plots are still missing fill information.
Any suggestions what could be wrong here?
Btw. Here my code:
# plot
p <- ggplot(gBasicCond, aes(x=color_switch, y=RT, fill=exp,shape=exp))+
geom_line(aes(group=exp)) + geom_point(aes(group=exp), size =4) +
geom_errorbar(limits,width = 0.1)+
scale_shape_manual(values=c(21,24)) +
scale_fill_manual(values=c("white","black")) +
geom_vline(xintercept = 2.5,linetype = "dotted")+ ylim(200,350) +
xlab('Target Selection') + ylab('Fixation duration (in ms)') +
scale_x_discrete( labels=c("Repetition","Switch","Single-target")) +
theme_bw() +
#scale_fill_discrete(name = 'Experiment', labels=c("Full fixation ", "Outline fixation")) +
scale_shape_discrete(name = 'Experiment',labels=c("Full fixation ", "Outline fixation")) +
Thanks,
E