I am trying to add a legend to my ggplot but I cannot edit the title nor what appears in the legend.
Below is the code that I am using to make the plot;
g <- ggplot()+geom_point(aes(y=Male.SVL,x= number,size=15),
data=n,show.legend = TRUE)+
labs(x="Nest", y="SVL (cm)",lab="B")+
geom_point(aes(y=Female.SVL,x=number,size=15),
show.legend=TRUE,data=n,color="blue")+
scale_y_continuous(limits = c(50,200))
g+theme_minimal()+theme(panel.grid.minor=element_blank(),
panel.grid.major=element_blank(),
axis.line.y = element_line(color = "black"),
axis.line.x = element_line(color="black"),
axis.text=element_text(size=12,face="bold"),
axis.text.x =element_blank(),
axis.title=element_text(size=17),
legend.background = element_rect(fill=NULL,size=.5,linetype = 0),
legend.position = c(.8,.2),
legend.title = element_text(size=12,face="bold"),
plot.title=element_text(hjust=0.5,size=20,face="bold"))+labs(tag="B")+
scale_color_manual(labels = c("Male","Female"), values = c("black","blue")
Which results in;
I would like to the legend to say Male="black dot", Female="blue dot"
My dataset looks like this;
ID Male Male SVL Female Female SVL
3_3_2015 BF-05 180.3 BE-02 124.46
7_7_2013 BF-05 180.3 BE-02 124.46
5_5_2012 CF-79 177.5 BF-33 142.24
CHIM_37_2016 CI-28 194.3 BF-94 133.2
This question is vastly different from other versions because of the integration of two separate geom objects. This detail prevents all other answers provided for manual legend editing from being used and requires a novel and different solution.