Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now
Answered Same Day Dec 29, 2021

Solution

Sanchi answered on Jan 13 2021
150 Votes
1. Create the following scatter plot for mtcars dataset. Hint: Use theme_classic() and scale_color_grey() to get a black and white plot with no background. (3 points)
Solution. Run the following R CODE for the prefe
ed scatter plot:
· install.packages("ggplot2")
· li
ary(ggplot2)
· ggplot(mtcars, aes(x=wt, y =mpg,col = factor(cyl))) +geom_point(aes(shape = factor(cyl))) + theme_classic(base_size = 11) + scale_colour_grey()
2. Create the following plot for the mtcars dataset. (3 points)
Solution. Run the following R CODE for the above given plot.
· install.packages(“ggplot2”)
· install.packages(“ggrepel”)
· li
ary(ggplot2)
· li
ary(ggrepel)
· set.seed(42)
· df <- mtcars
· .labs <- rownames(df)
· p <- ggplot(df) + aes(x = wt, y = mpg, label = .labs, fill = factor(cyl), segment.color = factor(cyl) ) + geom_label_repel( color = "white", point.padding = NA, box.padding = 0.1 ) + scale_fill_discrete(name = "cyl", aesthetics = c("fill", "segment.color") )
· p
3....
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here