Skip to content

Instantly share code, notes, and snippets.

@lucasverra
Last active August 18, 2017 18:43
Show Gist options
  • Save lucasverra/c187835b0aa7d2d497831bc6c1c098a3 to your computer and use it in GitHub Desktop.
Save lucasverra/c187835b0aa7d2d497831bc6c1c098a3 to your computer and use it in GitHub Desktop.
R_ggplot_diamonds_{r Price vs. Carat and Color}
```{r Price vs. Carat and Color}
ggplot(aes(x = carat, y = price, color = cut), data = diamonds) +
geom_point(alpha = 0.5, size = 1, position = 'jitter') +
scale_color_brewer(type = 'div',
guide = guide_legend(title = 'Cut', reverse = T,
override.aes = list(alpha = 1, size = 2))) +
scale_x_continuous(trans = cuberoot_trans(), limits = c(0.2, 3),
breaks = c(0.2, 0.5, 1, 2, 3)) +
scale_y_continuous(trans = log10_trans(), limits = c(350, 15000),
breaks = c(350, 1000, 5000, 10000, 15000)) +
ggtitle('Price (log10) by Cube-Root of Carat and Cut')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment