1. Plotting Mt_cars
data<-mtcars
View(data)
table(data$mpg)
## 
## 10.4 13.3 14.3 14.7   15 15.2 15.5 15.8 16.4 17.3 17.8 18.1 18.7 19.2 19.7   21 
##    2    1    1    1    1    2    1    1    1    1    1    1    1    2    1    2 
## 21.4 21.5 22.8 24.4   26 27.3 30.4 32.4 33.9 
##    2    1    2    1    1    1    2    1    1
barplot(table(data$mpg), 
        xlab="mpg of cars", 
        ylab="Numbers", 
        main="Cars according to mpg", 
        col="Red")

Comparison Between mpg & gear of cars

mosaicplot(table(data$mpg,data$gear), 
           col="Blue",
           main='Mosiac Plot')

          boxplot(data$mpg~data$gear)

Data visualization using ggplot2

library("ggplot2")
ggplot(data)+
  geom_point(mapping=aes(x=mpg,y=gear, alpha=mpg), col="Brown")

  1. Data Distribution of Cars
ggplot(data, aes(x=wt)) +     
    geom_histogram(aes(x=wt),               
    binwidth=.07,                   
    colour="Red", fill="pink") +   
  geom_density(alpha=.6, fill="#66ffff")