I did something very similar to your line 154 visualization. Excep that I turned is sideways and used an alpha of 3/100 because there were so many overlapping data points. I call it the smoke-trail graph.
Here's my code:
'## [ ] Visualize a combined distribution of cut, carat, and price.
'### Smoke-Trail Graph : The horizontal trail of smoke give a sense of the relationship of Carats and Prices for each Cut (facet).
'The height of the smoke-trail shows the size (Carat). Surprisingly, lower quality cuts often have larger sizes (carats) than high quality cuts.
'The slope and tightness of the smoke-trail indicates the strength of relationship between Carats and Price.
'Comparing one facet to another, you can see that Better Cuts (Premium and Ideal) have a wider distribution of prices, than Good and Fair Cuts.
ggplot(data = diamonds) +
geom_point(mapping = aes(x = price, y = carat), alpha = 3 / 100) +
facet_wrap(~ cut, ncol = 1) +
labs(
x = "Price",
y = "Size (Carat)",
title = "Price by Size, for each Cut") +
theme(panel.grid.minor.y = element_blank()) #takes out the minor horizontal white lines
Hi Brooks,
I did something very similar to your line 154 visualization. Excep that I turned is sideways and used an alpha of 3/100 because there were so many overlapping data points. I call it the smoke-trail graph.
Here's my code:
'## [ ] Visualize a combined distribution of cut, carat, and price.
'### Smoke-Trail Graph : The horizontal trail of smoke give a sense of the relationship of Carats and Prices for each Cut (facet).
'The height of the smoke-trail shows the size (Carat). Surprisingly, lower quality cuts often have larger sizes (carats) than high quality cuts.
'The slope and tightness of the smoke-trail indicates the strength of relationship between Carats and Price.
'Comparing one facet to another, you can see that Better Cuts (Premium and Ideal) have a wider distribution of prices, than Good and Fair Cuts.
ggplot(data = diamonds) + geom_point(mapping = aes(x = price, y = carat), alpha = 3 / 100) + facet_wrap(~ cut, ncol = 1) + labs( x = "Price", y = "Size (Carat)", title = "Price by Size, for each Cut") +
theme(panel.grid.minor.y = element_blank()) #takes out the minor horizontal white lines