Skip to content

Instantly share code, notes, and snippets.

@suncoolsu
Created February 6, 2011 10:04
Show Gist options
  • Save suncoolsu/813273 to your computer and use it in GitHub Desktop.
Save suncoolsu/813273 to your computer and use it in GitHub Desktop.
How do I change the key labels in this plot?
qplot(depth, data=diamonds, geom="density", xlim = c(54, 70),
fill = cut, alpha = I(0.2)) +
labs(fill = "My Style \nDensity Plot" )
@berndweiss
Copy link

Something like this?

  qplot(depth, data=diamonds, geom="density", xlim = c(54, 70),
            fill = cut, alpha = I(0.2)) +
        scale_fill_discrete(name = "My Style \nDensity Plot",  
            breaks = levels(diamonds$cut), labels = letters[1:5])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment