Page 272 - Data Science class 11
P. 272
p <- ggplot(dat, aes(x = setting, y= rating))+ geom_boxplot()
p
# Saving the file.
dev.off()
Running this code snippet will show the following:
The corresponding Box plot is also shown.
7.10 Maps usIng ggplot2
Visualizing data is crucial in today’s world. Without powerful visualisations, it is almost impossible to create and
narrate data-based stories on humongous data. These stories help us build strategies and make intelligent business
decisions. Maps are commonly used to visualise certain factors that have been influenced geographically. It is easy
to plot maps in R.
7.10.1 plot a geographical Map
Let’s plot the countries participating in the ICC World T20 World Cup 2016. After I did my research, I found there were
16 countries participating this year. Let’s see where these countries are located on the world map.
You’ll use the ggmaps package along with ggplot to create these maps.
Example
Enter the following code snippet in the script panel:
#List of Countries
> ICC_WC_T20 <- c("Australia",
270 Touchpad Data Science-XI

