powered by
Utility functions that return simple ggplot2 examples to demonstrate discrete color/fill scales.
example_scatterplot()example_barplot()
example_barplot()
A ggplot object.
ggplot
example_scatterplot() creates a scatter plot of large diamonds (carat >= 2.2), mapping table to the x‑axis, price to the y‑axis, and cut to color.
example_scatterplot()
carat >= 2.2
table
price
cut
example_barplot() creates a side‑by‑side bar chart of diamond counts by color, grouped by cut via fill.
color
example_scatterplot() example_barplot()
Run the code above in your browser using DataLab