Module # 7 Visual Distribution Analysis
For this assignment, I decided to use the popular mtcars dataset. I chose to use ggplot2 to create this graph as it makes my plot look much more appealing to the reader. For my visual analysis, I created a scatter plot comparing the displacement to the miles per gallon. From the results of my graph, we can see that the higher the car's miles per gallon, the lower the displacement. I like the use of a scatter plot in the situation because it shows the linear downward trend of the data.
car <- mtcars
#scatterplot of displacement and miles per gallon
ggplot(mtcars, aes(x = mpg, y = disp)) + geom_point() + xlab("Displacement") + ylab("Miles per gallon")
#shows the higher the mpg the lower the displacement
Comments
Post a Comment