Page 268 - Data Science class 11
P. 268
Here, too, we’ll use the R built-in mtcars data set.
# Simple Scatterplot
attach(mtcars)
# Give the chart file a name.
png(file = "scatter1.png")
# Plotting the chart
plot(wt, mpg, main="Scatterplot Example",
xlab="Car Weight ", ylab="Miles Per Gallon ", pch=19)
# Add fit lines
abline(lm(mpg~wt), col="red")
lines(lowess(wt,mpg), col="blue")
# Saving the file.
dev.off()
7.9 Box plot
A box plot is a graphical technique for summarising a set of data on an interval scale. Boxplots are extensively used
in descriptive data analysis. Using this, we can show the shape of the distribution, its central value, and its variability.
266 Touchpad Data Science-XI

