creating scatterplot in R Programming

For this exam, you need package ‘ggplot2’: install.packages(“ggplot2”). Two datasets that are shipped with the ggplot2 package: diamonds: describing the prices of more than 50,000 cut diamonds and msleep describing the sleep times of 83 mammals. Then,

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper
  1. Create a scatterplot with carat along the x-axis and price along the y-axis. Change the x-axis label to read “Weight of the diamond (carat)” and the y-axis label to “Price (USD).” Use cut to set the color of the points.
  2. Try adding the argument alpha = 1 to geom_point, i.e. geom_point(alpha = 1). Does anything happen? Try changing the 1 to 0.5 and 0.25 and see how that affects the plot.
  3. Change the scatterplot from above, so that diamonds with different cut qualities are represented by different shapes.
  4. Change the scatterplot from above, so that the size of each point is determined by the diamond’s length, i.e. the variable x.

Still stressed from student homework?
Get quality assistance from academic writers!

Order your essay today and save 25% with the discount code LAVENDER