Visualizing data with ggplot2 in R

Question

Have you heard about the most popular package for visualizing data in a stunning way in R, i.e ggplot2 (grammar of graphics) ? How to deal with it ?

solved 0
[email protected] 4 years 1 Answer 698 views Member 0

Answer ( 1 )

  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
    Best answer

Leave an answer

Browse
Browse