You can also add your threshold to the legend: ggplot(risk_accum)+ geom_line(aes(x = date, y = risk, color = color_var)) + geom_line(aes(date, y= 12, linetype = "threshold"), size = 0.1)+ scale_y_continuous(name = "EBH accumulation")+ scale_color_id...
Now to manually change legend colours and labels usingscale_colour_manual(). I want to pass the number for each group into anexpression()function that will render the corresponding label in the legend of the graph, like so ggplot(data=d,mapping=aes(x=time,y=out,colour=group))+g...
ggp_new<-ggplot(data_new, aes(x, y, color=group))+# Recreate plotgeom_point()ggp_new# Draw updated plot Figure 2 shows the output of the previous R code: The legend items were ordered according to the specification of factor levels that we did before. ...
I am trying to make a legend for my data that would reflect bar colours. When I add “col = status” it adds the legend but with dark grey colour inside. Any help would be appreciated? The code I am using is: p1 <- ggplot(d1, aes(x= reorder(gene, -fold_change), y= fold_ch...