-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVisualization(ggplot, scatterr, WHO data).R
More file actions
24 lines (23 loc) · 1.27 KB
/
Copy pathVisualization(ggplot, scatterr, WHO data).R
File metadata and controls
24 lines (23 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
rm(list=ls())
WHO=read.csv("C:/users/zahid/downloads/WHO.csv")
str(WHO)
plot(WHO$GNI,WHO$FertilityRate)
library(ggplot2)
scatterplot=ggplot(WHO, aes(x=GNI,y=FertilityRate))
scatterplot+geom_point()
scatterplot+geom_line()
scatterplot+geom_point(color="blue", size=3, shape=17)
scatterplot+geom_point(color="darkred", size=3, shape=8)
scatterplot+geom_point(color="darkred", size=3, shape=8) + ggtitle("Fertility Rate vs. Gross National Income")
fertilityGNIplot=scatterplot+geom_point(color="darkred", size=3, shape=8) + ggtitle("Fertility Rate vs. Gross National Income")
pdf("C:/users/zahid/downloads/MyPlot.pdf")
print(fertilityGNIplot)
dev.off()
ggplot(WHO, aes(x=FertilityRate,y=Under15, color=Region)) +geom_point()
ggplot(WHO, aes(x=FertilityRate, y=Under15))+geom_point()
ggplot(WHO, aes(x=log(FertilityRate), y=Under15))+geom_point()ggplot(WHO, aes(x=log(FertilityRate), y=Under15))+geom_point()
ggplot(WHO, aes(x = FertilityRate, y = Under15)) + geom_point() + scale_color_brewer(palette="Dark2")
model=lm(Under15~ log(FertilityRate), data=WHO)
summary(model)
ggplot(WHO, aes(x=log(FertilityRate), y=Under15))+geom_point()+stat_smooth(method="lm" , level=0.99, se=FALSE, color="orange")
ggplot(WHO, aes(x = FertilityRate, y = Under15)) + geom_point() + scale_color_brewer(palette="Dark2")