Hello everyone,

I am using ggplot to plot the following graph (one example attached). What I want to achieve is to have one legend to show linetype 4 & shape 1 combined as "group 1" and linetype 1 & shape 2 combined as "group 2". Also, the legend name will be something such as "example legend"

I tried scale_shape_manual and scale_linetype_manual. However, I didn't find the right way. The code is listed as below (the graph has no legend which I want to add correctly)

Thanks.

```
y1 <- x+0.01
y2 <- x+10
df1 <- data.frame(x, y1)
df2 <- data.frame(x, y2)
graph_1 <- subset(df1,x>=0 & x<=5)
graph_2 <- subset(df1,x>=6 & x<=10)
graph_3 <- subset(df1,x>=11 & x<=15)
graph_4 <- subset(df2,x>=0 & x<=5)
graph_5 <- subset(df2,x>=6 & x<=10)
graph_6 <- subset(df2,x>=11 & x<=15)
win.graph(width = 13,height = 6,pointsize = 8)
ggplot() + geom_point(aes(x, y1),data = graph_1,shape =1) + geom_smooth(aes(x, y1),data = graph_1,method = 'loess',linetype=4) +geom_point(aes(x, y1),data = graph_2,shape =1) + geom_smooth(aes(x, y1),data = graph_2,method = 'loess',linetype=4) + geom_point(aes(x, y1),data = graph_3,shape =1) + geom_smooth(aes(x, y1),data = graph_3,method = 'loess',linetype=4)+ geom_point(aes(x, y2),data = graph_4,shape =2) + geom_smooth(aes(x, y2),data = graph_4,method = 'loess',linetype=1) +geom_point(aes(x, y2),data = graph_5,shape =2) + geom_smooth(aes(x, y2),data = graph_5,method = 'loess',linetype=1) + geom_point(aes(x, y2),data = graph_6,shape =2) + geom_smooth(aes(x, y2),data = graph_6,method = 'loess',linetype=1)
```