Created
May 19, 2017 14:17
-
-
Save infotroph/24fad7b8c3a11740e2e1bd724da26520 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Have: | |
| # A scatterplot with points grouped by binning a continuous variable. | |
| (ggplot(mtcars, aes(wt, mpg, color=carb>2)) | |
| +geom_point() | |
| +geom_smooth(aes(color=carb>2), method="lm")) | |
| # Also have: | |
| # A scatterplot with the smoothers grouped but points colored continuously | |
| (ggplot(mtcars, aes(wt, mpg, color=carb)) | |
| +geom_point() | |
| +geom_smooth(aes(lty=carb>2), method="lm")) | |
| # Want: | |
| # Smoothers coded by one discrete color scale, points coded by a second continuous color scale | |
| (ggplot(mtcars, aes(wt, mpg, color=carb)) | |
| +geom_point() | |
| +geom_smooth(aes(color=carb>2), method="lm")) | |
| # Error: Discrete value supplied to continuous scale |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment