I have this plot made in ggplot2
With the following code:
colors4 <- c("Exp" = "#000000", "TL 1" = "#56B4E9", "TL 2"="#CC79A7", "TL 3"="#009E73", "TL 4"="#D55E00", "Model"="#999999")
ggplot(binodalbetla, aes(x=w.sal,y=w.tpc,colour=Category), show.legend=FALSE)+
geom_line(data=subset(binodalbetla,Category == "TL 1"),linewidth=1.2)+
geom_line(data=subset(binodalbetla,Category == "TL 2"),linewidth=1.2)+
geom_line(data=subset(binodalbetla,Category == "TL 3"),linewidth=1.2)+
geom_line(data=subset(binodalbetla,Category == "TL 4"),linewidth=1.2)+
geom_line(data=subset(binodalbetla,Category == "Model"),linewidth=1.2)+
geom_point(data=subset(binodalbetla,Category == "Exp"), aes(color="Exp"), size=2, shape=5)+
labs(
x = expression(w[Salt]),
y = expression(w[TPC]),
title = bquote(Bet~":"~2~LA~"/"~K[3]~PO[4])) +
scale_color_discrete(name="") +
theme(panel.background = element_rect(fill = "white", colour = "grey50"), axis.text.x= element_text(face="bold", size=20), axis.text.y= element_text(face="bold", size=20), axis.text=element_text(size=34), axis.title.x = element_text(size=28), axis.title.y = element_text(size=28), title=element_text(size=34,face="bold"), legend.title= element_blank(), legend.text=element_text(size=30)) +
ylim(0,1)+
scale_color_manual(values = colors4)
It is fine, but the problem is that in the legend a diamond symbol appears (because I chose shape=5 in geom_point). I would like that in the legend only the diamond simbol appears (without the black line), while for the other only the coloured lines are showed, is there any option?
Here is a minimal reproducible dataset:
binodalbetla
Category w.sal w.tpc
1 Exp 0.36964296 0.089970010
2 Exp 0.35235401 0.111331692
3 Exp 0.32564172 0.147805666
4 Exp 0.30792464 0.170437196
5 Exp 0.27185358 0.219397133
6 Exp 0.25057568 0.247797606
7 Exp 0.23468525 0.274395726
8 Exp 0.19402343 0.385795245
9 Exp 0.16116004 0.440709359
10 Exp 0.13430737 0.494772301
11 Exp 0.10794299 0.548779986
12 Exp 0.08918584 0.594597503
13 Exp 0.07037506 0.645092388
14 Exp 0.04556309 0.702074353
15 TL 1 0.33234165 0.195207709
16 TL 1 0.45051932 0.025008216
17 TL 1 0.15453553 0.451284098
18 TL 2 0.29572918 0.298255159
19 TL 2 0.48062042 0.014280041
20 TL 2 0.06463047 0.653192383
21 TL 3 0.34704979 0.251874003
22 TL 3 0.50379819 0.008956064
23 TL 3 0.04385440 0.726794834
24 TL 4 0.29369441 0.348022565
25 TL 4 0.51158047 0.007416504
26 TL 4 0.03488902 0.752779981
27 Model 0.00300000 0.980858995
28 Model 0.00400000 0.964341288
29 Model 0.00500000 0.950018816
30 Model 0.00600000 0.937252593
31 Model 0.00700000 0.925663241
32 Model 0.00800000 0.915003704
33 Model 0.00900000 0.905102457
34 Model 0.01000000 0.895834667
35 Model 0.01100000 0.887106136
36 Model 0.01200000 0.878843704
37 Model 0.01300000 0.870989212
38 Model 0.01400000 0.863495518
39 Model 0.01500000 0.856323778
40 Model 0.01600000 0.849441