[Solved] How to add a legend to ggplot when aes are constant for stat_smooth

You can still use aes in each stat_smooth including only the desired color. This will add legends to the plot. Then you can use scale_color_identity to match and rename the colors ggplot(mtcars, aes(x=wt, y = mpg, col=”green”)) + geom_point(col=”blue”) + stat_smooth(method=’loess’,linetype=”dashed”, aes(color = “red”), span=0.1) + stat_smooth(method=’loess’,linetype=”dashed”, aes(color = “orange”), span=0.25) + stat_smooth(method=’loess’,linetype=”dashed”, aes(color = … Read more

[Solved] ploting ggmap with geom Points (lat_long) annotated 1 to19. Points data is in CSVfile

Here is one approach. I created new lat for text annotation using transform in base R. I used geom_text to add the labels you wanted. I used scale_colour_discrete to change the name of the legend. library(ggmap) library(ggplot2) ### Get a map map <- get_map(location=c(lon=34.832, lat=0.852), color=”color”, source=”google”, maptype=”terrain”, zoom=9) ### Create new lat for annotation … Read more