Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# Modify the following code to remove the legend title. Then, place the legend in top left position
gg <- ggplot(midwest, aes(x=area, y=poptotal)) + # Define Data
geom_point(aes(col=state, size=popdensity)) + # Add scatterplot
geom_smooth(method="lm", col="firebrick", se=F) + # Add best fit line
coord_cartesian(xlim=c(0, 0.1), ylim=c(0, 250000)) + # Limit X and Y axis
labs(title="Area Vs Population", y="Population", x="Area") # Labels
plot(gg)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.