Visualizing data with ggplot2 in R
Question
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
It will take less than 1 minute to register for lifetime. Bonus Tip - We don't send OTP to your email id Make Sure to use your own email id for free books and giveaways
Answer ( 1 )
Ggplot2 is the powerful plotting package that makes simple to create complex charts in a beautifully stunning ways. Its a grammar of graphics having visual properties to represent the data. Begin your plot with ggplot().
“How to install it in R? ”
install.packages(“ggplot2”)
library(ggplot2)
General expression:
ggplot(data = ) +
(mapping = aes())
For example: For the mpg data set:
ggplot(data = mpg) +
geom_smooth(mapping = aes(x = displ, y = hwy, linetype = drv))
Components of Graphs are:
1.Data
2.Aesthetic mapping
3.Geom (geometric object)
4.Stat (statistical transformation)
5.Position adjustment
For making use of the components in the correct way ,one can go through the cheatsheet attached in the answer.
Attachment