Research breakthrough possible @S-Logix

Office Address

  • 2nd Floor, #7a, High School Road, Secretariat Colony Ambattur, Chennai-600053 (Landmark: SRM School) Tamil Nadu, India
  • +91- 81240 01111

Social List

How to implement Area Chart using ggplot2 in R?


To implement the area chart using ggplot2 in R programming.


Package and Function:

   R Package : ggplot2

   R Function :ggplot(x, aes(x= , y= ), fill= )

   R Function : geom_area(colour =)

x - Data Set

aes- Aesthetic mappings describe

   how variables in the data are mapped to visual properties (aesthetics) of geoms.

   Aesthetic mappings can be set in ggplot2() and in individual layers.

Sapmle Code

#Area Chart Using ggplot2

#Loading required Packages







input<-read.xlsx(“OnlineShopping.xlsx”,sheetIndex = 1)



#Area Chart

ggplot(input,aes(x=income,y=age,fill=commodity)) + geom_area()

ggplot(input,aes(x=income,y=age,fill=commodity)) + geom_area(colour=”Black”)

implement Area Chart using ggplot2 in R
Area Chart Using ggplot2
Loading required Packages