Answered by : connor-rothschild
### Three options (where p is the plot object)
# Remove the legend title:
p + theme(legend. title = element_blank())
# Hide the entire legend to create a ggplot with no legend.
p + theme(legend. position = "none")
# Hide legend for a specific geometry, say geom_text().
p + geom_text(show.legend = FALSE)
Source : | Last Update : Mon, 06 Jul 20
Answered by : cute-cowfish-snnzcx7a0y6j
scale_color_manual(values = c("#D16103", "#4E84C4"), labels = c("Justin", "Myself"))
Source : | Last Update : Wed, 18 Mar 20
Answered by : evil-elephant-443b1gfng5vj
+ labs(color='NEW LEGEND TITLE')
Source : https://stackoverflow.com/questions/14622421/how-to-change-legend-title-in-ggplot | Last Update : Wed, 07 Apr 21
Answered by : relieved-rhinoceros-j782r696ht0y
bp + theme(legend.position="none")
Source : https://stackoverflow.com/questions/35618260/remove-legend-ggplot-2-2 | Last Update : Wed, 27 May 20
Answered by : ethan-rrah44oerogw
{"tags":[{"tag":"textarea","content":"+ labs(fill='NEW LEGEND TITLE')","code_language":"whatever"}]}
Source : https://stackoverflow.com/questions/14622421/how-to-change-legend-title-in-ggplot | Last Update : Tue, 18 Apr 23
Answered by : bowhaven
p + scale_fill_discrete(name = "New Legend Title")
Source : https://stackoverflow.com/questions/14622421/how-to-change-legend-title-in-ggplot | Last Update : Thu, 29 Jul 21
Answered by : ethan-rrah44oerogw
{"tags":[{"tag":"textarea","content":"# filter dataframe to get data to be highligheted\nhighlight_df <- gapminder %>% \n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0filter(gdpPercap>=59000)\n \ngapminder %>% \n ggplot(aes(x=lifeExp,y=gdpPercap)) + \n geom_point(alpha=0.3) +\n geom_point(data=highlight_df,\n aes(x=lifeExp,y=gdpPercap, color=country),size=3)","code_language":"whatever"}]}
Source : https://cmdlinetips.com/2019/05/how-to-highlight-select-data-points-with-ggplot2-in-r/ | Last Update : Tue, 18 Apr 23