Professional Documents
Culture Documents
Create a scatter plot with product on the x axis and Amount on the y axis.
Code:
> library(ggplot2)
> mydata <- read.csv("C:/Users/Das/Desktop/file_imp/data_Visualiz/
fruits.csv")
> mydata
Result :
Create the histogram and box plot by taking the necessary attribute.
Code:
> ggplot(mydata, aes(x=Amount)) + geom_histogram(colour="red", fill="grey")
Result:
Code:
> p10 <- ggplot(mydata, aes(x = Country, y = Amount)) +
+ geom_boxplot()
> p10
Result:
Map the color of the the points to region.
Code:
> ggplot(mydata, aes(x = Product, y = Amount)) +
+ geom_point(aes(color = Product))
Result:
Make the points bigger by setting size to 2 Code:
> ggplot(mydata, aes(x = Product, y = Amount)) +
+ geom_point(aes(color = Product),size = 2)
Result:
Recreate a scatter plot with amount on the x axis and product on the y axis.
Code:
> ggplot(mydata, aes(y = Product, x = Amount)) +
+ geom_point(aes(color = Product),size = 2)
Result:
Overlay a smoothing line on top of the scatter plot using geom_smooth Code:
> ggplot(mydata, aes(x=Product, y= Amount)) +
+ geom_point() +
+ geom_smooth(span = 0.1)
Result:
K MEANS CLUSTERING - 1ST AUGUST
Question 1:
Code :
Result: