Is the data table glyph ready? If not, do I need to need to convert table formats (i.e. narrow to wide) or join another table? - The table is glyph ready.
What are the glyphs? - Bold dots and the linear regression line.
What are the aesthetics? - Price, Carat, and Cut are the main ones.
What are the scales (i.e. mappings)
Are there fixed attributes (i.e. col = “red”)? Price, Price’s text, and Carat are all red bolded and Diamonds is blue bolded.
Are there labels and themes? Cut, Price, Carat, and Diamonds all must be labeled. Themes are needed to color them in and their respective texts.
Source file ⇒ Lab4.Rmd
The Graph:
d <- diamonds[sample(nrow(diamonds), 1000), ]
head(d)
## Source: local data frame [6 x 10]
##
## carat cut color clarity depth table price x y z
## (dbl) (fctr) (fctr) (fctr) (dbl) (dbl) (int) (dbl) (dbl) (dbl)
## 1 0.53 Ideal E SI1 61.9 55 1585 5.20 5.24 3.23
## 2 1.55 Premium E SI2 58.5 57 7161 7.66 7.57 4.46
## 3 0.57 Ideal E VS1 61.0 56 2297 5.38 5.40 3.29
## 4 0.45 Very Good H VVS1 62.3 57 1274 4.90 4.93 3.06
## 5 0.30 Ideal G VS1 62.0 54 776 4.35 4.30 2.68
## 6 0.35 Premium G VS1 62.6 56 845 4.52 4.49 2.82
ggplot(d, aes(x = carat, y = price, col = cut)) + geom_point(size = 6, col = "black") + stat_smooth() + facet_wrap(~cut) + labs(title = "Diamonds", x = "Carat", y = "Price") + theme(axis.text.x = element_text(size = 10), axis.text.y = element_text(colour = "#ff6666" , size = 10)) + theme(plot.title = element_text(size = 50, colour = "#668cff"), axis.title.x = element_text(size = 20, colour = "#ff8080"), axis.title.y = element_text(size = 20, colour = "#ff8080"))