EM 526_Lab Assignment 03
EM 526_Lab Assignment 03
Faculty of Engineering
Lab Assignment 03
Instructions: Create a PDF file containing the answers (R codes and outputs) to the
following questions.
1) Obtain the dataset ‘diamonds’ using the package ‘ggplot2’and perform the following tasks.
Histogram 01: Border of bins should be “yellow” filled with “red” color and the bin width
should be 500.
Histogram 02: Border of bins should be “blue” filled with “yellow” and a bin width of 100.
b) Draw a scatter plot where x-axis is “price” and y-axis is “carat”. Subgroup the points under
the variable “cut”.
c) Draw a scatter plot where x-axis is “price” and y-axis is “carat”. Subgroup the points under
the variable “cut” using the “facet_grid()” function.
d) Draw a boxplot where x-axis is “cut”, y-axis is “price and change the boxplot colors
according to the categories of the variable “cut”.