table(salary)
barplot(salary)
barplot(table(salary),
main="salary Count of 6 Students",
xlab="empname",
ylab="Count",
border="red",
col="blue",
density=6)
# Simple Pie Chart
slices <- c(10, 12,4, 16, 8)
lbls <- c("US", "UK", "Australia", "Germany", "France")
pie(slices, labels = lbls, main="Pie Chart of Countries")
# Pie Chart with Percentages
slices <- c(10, 12, 4, 16, 8)
lbls <- c("US", "UK", "Australia", "Germany", "France")
pct <- round(slices/sum(slices)*100)
lbls <- paste(lbls, pct) # add percents to labels
lbls <- paste(lbls,"%",sep="") # ad % to labels
pie(slices,labels = lbls, col=rainbow(length(lbls)),
main="Pie Chart of Countries")
barplot(salary,
main = "Salary",
xlab = "Rs",
ylab = "Employee",
[Link] = c("ravi","shas","ria","suma","roy","kiran"),
col = "darkred",
horiz = TRUE)
empname=c("ravi","shashi","ria","suma","roy","kiran")
salary=c(2300,1250,3500,4200,5100,2250)
df=[Link](empname,salary)
print(df)
barplot(salary,
main = "Salary",
xlab = "Rs",
ylab = "Employee",
[Link] = c("ravi","shashi","ria","suma","roy","kiran"),
col = "darkred",
horiz = FALSE)
# Simple Pie Chart
slices <- c(10, 12,4, 16, 8)
lbls <- c("US", "UK", "Australia", "Germany", "France")
pie(slices, labels = lbls, main="Pie Chart of Countries")
# Pie Chart with Percentages
slices <- c(10, 12, 4, 16, 8)
lbls <- c("US", "UK", "Australia", "Germany", "France")
pct <- round(slices/sum(slices)*100)
lbls <- paste(lbls, pct) # add percents to labels
lbls <- paste(lbls,"%",sep="") # ad % to labels
pie(slices,labels = lbls, main="Pie Chart of Countries")
col c("red", "orange","yellow,","green","blue")
data()
pie()
expenditure =("Housing","Food","Cloths","Entertainment" "Other")
Housing Food Cloths Entertainment Other
600 300 150 100 200
GGPLOT
library(ggplot2)
View(diamonds)
ggplot(diamonds, aes(x= carat, y=price))
ggplot(diamonds, aes(x= carat, y=price))+geom_point()
ggplot(diamonds, aes(x= carat, y=price))+geom_point()+xlim(c(0,3))+ylim(c(0,20000))
ggplot(diamonds, aes(x= carat, y=price))+geom_point()+
labs(title= "Carat Vs Price",
subtitle = "From dataset diamonds",
x= "Carat", y= "Price in $",
caption =" plot shows how price varies with respect carat")
ggplot(diamonds, aes(x= carat, y=price))+geom_point(col= "blue", size=1, shape=18)+
labs(title= "Carat Vs Price",
subtitle = "From dataset diamonds",
x= "Carat", y= "Price in $",
caption =" plot shows how price varies with respect carat")
ggplot(diamonds, aes(x= carat, y=price))+
geom_point( col = "blue",size= 1, shape =18)+
geom_smooth(method = "im", col= "red")+
labs(title= "Carat Vs Price",
subtitle = "From dataset diamonds",
x= "Carat", y= "Price in $",
caption =" plot shows how price varies with respect carat")
ggplot(diamonds, aes(x= carat, y=price))+
geom_point( col = "orange",size= 1, shape =18)+
geom_smooth(method = "lm", col= "red")+
labs(title= "Carat Vs Price",
subtitle = "From dataset diamonds",
x= "Carat", y= "Price in $",
caption =" plot shows how price varies with respect carat")+
coord_cartesian(ylim=c(0,20000))
ggplot(diamonds, aes(x= carat, y=price, color =cut))+
geom_point(size=1)+
geom_smooth()+
labs(title= "Carat Vs Price",
subtitle = "From dataset diamonds",
x= "Carat", y= "Price in $",
caption =" plot shows how price varies with respect carat")
ggplot(diamonds, aes(x= carat, y=price, color=cut))+
geom_point(size=1)+
geom_smooth()+
labs(title= "Carat Vs Price",
subtitle = "From dataset diamonds",
x= "Carat", y= "Price in $",
caption =" plot shows how price varies with respect carat")+
facet_wrap(~cut, ncol=2)