Recently Published
Cloud of points plot-4
> x <- rnorm(100,10,5)
> y <- 3*x+1
> means <- data.frame(x,y)
> x <- c(-5,25)
> y <- 3*x+1
> line = data.frame(x,y)
> ggplot()+geom_point(data=means,aes(x=x,y=y),color="red")+
+ geom_line(data=line,aes(x=x,y=y))+
+ scale_x_continuous(limits = c(-10,30))+
+ scale_y_continuous(limits = c(-20,80))+
+ geom_point(data=dat,aes(x=x,y=y))
Cloud of points plot-3
> x <- rnorm(100,10,5)
> y <- 3*x+1
> means <- data.frame(x,y)
> x <- c(-5,25)
> y <- 3*x+1
> line = data.frame(x,y)
> ggplot()+geom_point(data=means,aes(x=x,y=y),color="red")+
+ geom_line(data=line,aes(x=x,y=y))+
+ scale_x_continuous(limits = c(-10,30))+
+ scale_y_continuous(limits = c(-20,80))
Cloud of points plot-2
> x <- rnorm(100,10,5)
> y <- 3*x+1
> means <- data.frame(x,y)
> x <- c(-5,25)
> y <- 3*x+1
> line = data.frame(x,y)
> ggplot()+geom_point(data=means,aes(x=x,y=y),color="red")+
+ geom_line(data=line,aes(x=x,y=y))
Cloud of points plot-1
> x <- rnorm(100,10,5)
> y <- 3*x+1
> means <- data.frame(x,y)
> ggplot()+geom_point(data=means,aes(x=x,y=y),color="red")
Samples along a Line-3
> x <- c(0,25)
> y <- 3*x+1
> line <- data.frame(x,y)
> x <- c(1,9,15,22)
> y <- 3*x+1
> means <- data.frame(x,y)
> means
> x <- c(rep(1,100),rep(9,100),rep(15,100),rep(22,100))
> y <- c(rnorm(100,4,10),rnorm(100,28,10),rnorm(100,46,10),rnorm(100,67,10))
> dat <- data.frame(x,y)
> ggplot()+geom_line(data=line,aes(x=x,y=y))+
+ geom_point(data=means,aes(x=x,y=y),size=5,color="red")+
+ geom_point(data=dat,aes(x=x,y=y))
Samples along a Line-2
> x <- c(0,25)
> y <- 3*x+1
> line <- data.frame(x,y)
> x <- c(1,9,15,22)
> y <- 3*x+1
> means <- data.frame(x,y)
> means
> ggplot()+geom_line(data=line,aes(x=x,y=y))+
+ geom_point(data=means,aes(x=x,y=y),size=5,color="red")
Samples along a Line-1
> x <- c(0,25)
> y <- 3*x+1
> line <- data.frame(x,y)
> ggplot()+geom_line(data=line,aes(x=x,y=y))
Ploting a Vertical Plot-2
> x <- rep(1,100)
> x
> x <- c(x,rep(9,100))
> x
> x <- c(x,rep(15,100))
> x
> y <- rnorm(100,50,10)
> y
> y <- c(y,rnorm(100,30,10))
> y
> y <- c(y,rnorm(100,78,10))
> y
> dat <- data.frame(x,y)
> dat
> x <- c(1,9,15)
> x
> y <- c(50,30,78)
> y
> means <- data.frame(x,y)
> means
> ggplot()+geom_point(data=dat,aes(x=x,y=y))+
+ geom_point(data=means,aes(x=x,y=y),size=5,color="red")
Ploting a Vertical Plot
> x <- 1
> y <- 50
> mean <- data.frame(x,y)
> mean
> x <- rep(1,100)
> y <- rnorm(100,50,10)
> dat <- data.frame(x1,y1)
> dat
> ggplot()+geom_point(data=dat,aes(x=x,y=y))+
+ geom_point(data=mean,aes(x=x,y=y),size=5,color="red")
Line Grapg GG_Plot-6
> x <- c(0,10)
> y <- .5*x-.73
> dat <- data.frame(x,y)
> ggplot()+geom_line(data=dat,aes(x=x,y=y),size=3,color="red")
Line Graph GG_Plot-5
> x <- c(0,10)
> y <- -5*x-7
> dat <- data.frame(x,y)
> ggplot()+geom_line(data=dat,aes(x=x,y=y),size=3,color="red")
Line Graph GG_Plot-4
> x <- c(0,10)
> y <- 3*x+1
> dat <- data.frame(x,y)
> ggplot()+geom_line(data=dat,aes(x=x,y=y))
Line Graph GG_Plot-3
> x <- c(1,8)
> y <- c(3,10)
> dat <- data.frame(x,y)
> dat
> dat$x
> dat$y
> dat$x <- c(-2,7)
> dat$y <- c(13,-5)
> dat
> ggplot()+geom_line(data=dat,aes(x=x,y=y))
> ggplot()+geom_line(data=dat,aes(x=x,y=y),size=5,color="darkolivegreen")
Line Grapg GG_Plot-2
> x1 <- c(-2,13)
> y1 <- c(7,-5)
> dat1 <- data.frame(x1,y1)
> dat1
> ggplot()+geom_line(data=dat,aes(x=x1,y=y1),size=3,color="darkgoldenrod4")
Graphing Line GG_Plot-1
> x <- c(1,8)
> y <- c(3,10)
> dat <- data.frame(x,y)
> dat
> ggplot()+geom_line(data=dat,aes(x=x,y=y))
> ggplot()+geom_line(data=dat,aes(x=x,y=y),size=3,color="darkgoldenrod4")
GG_Plot-5
> x <- c(5,2,1)
> y <- c(6,4,9)
> dat <- data.frame(x,y)
> dat
> ggplot()+geom_point(data=dat,aes(x=x,y=y),size=10,color="blue")+
+ scale_x_continuous(limits = c(0,15), breaks = seq(0,15,5))+
+ scale_y_continuous(limits = c(0,15), breaks = seq(0,15,5))
GG_Plot-4
> x <- c(5,2,1)
> y <- c(6,4,9)
> dat <- data.frame(x,y)
> dat
> ggplot()+geom_point(data=dat,aes(x=x,y=y),size=10,color="blue")+
+ scale_x_continuous(limits = c(0,15), breaks = seq(0,15,1))+
+ scale_y_continuous(limits = c(0,15), breaks = seq(0,15,1))
GG_Plot-3
> x <- c(5,2,1)
> y <- c(6,4,9)
> dat <- data.frame(x,y)
> dat
> ggplot()+geom_point(data=dat,aes(x=x,y=y),size=10,color="blue")+
+ scale_x_continuous(limits = c(0,15))+
+ scale_y_continuous(limits = c(0,15))
GG_Plot-2
> x <- c(5,2,1)
> y <- c(6,4,9)
> dat <- data.frame(x,y)
> dat
> ggplot()+geom_point(data = dat,aes(x = x,y = y),size=5,color="red")
GG_Plot-1
> x <- 4
> y <- 9
> dat <- data.frame(x,y)
> dat
> ggplot()
> ggplot()+geom_point(data = dat,aes(x = x,y = y),size = 5,color = "blue")
Function_esoph_Plot-2
> bplt <- function(x,n){
+ plot(x[1:n])
> }
> bplt(esoph$agegp,25,horiz=T)
Function_esoph_Plot-1
> bplt <- function(x,n){
+ plot(x[1:n])
> }
> bplt(esoph$agegp,25)
Triple_dot_Argument_Used_PCH_Plot-2
> data2 <- function(mu,sig,n=1000,...) {
+ x <- sort(rnorm(n,mu,sig))
+ y <- dnorm(x,mu,sig)
+ plot(x,y,...)
> }
> data2(10,5,50,pch=10)
Triple_dot_Argument_Plot-1
> data2 <- function(mu,sig,n=1000,...) {
+ x <- sort(rnorm(n,mu,sig))
+ y <- dnorm(x,mu,sig)
+ plot(x,y,...)
> }
> data2(10,5,50,type="o")
Optional_Argument-Plot-2
> data1 <- function(mu,sig,n=1000) {
+ x <- rnorm(n,mu,sig)
+ y <- dnorm(x,mu,sig)
+ plot(x,y)
> }
> data1(10,5)
Optional_Argument-Plot-1
> data1 <- function(mu,sig,n=1000) {
+ x <- rnorm(n,mu,sig)
+ y <- dnorm(x,mu,sig)
+ plot(x,y)
> }
> data1(10,5,50)
Arg_Function_Plot-1
> norm <- function(mu,sig,n=1000) {
+ x <- rnorm(n,mu,sig)
+ y <- dnorm(x,mu,sig)
+ plot(x,y)
> }
> norm(10,5,100)
> norm(10,5)
Function_eshop_plot
> ## Age Group of eshop
> bplt <- function(x){
+ # The function creates a bar plot
+ plot(x)
+ }
> bplt(esoph$agegp)
Function_Plot-2
> norm1 <- function(n,mu,sig){
+ # This is a function that plots the baell curve given n,mu and sigma.
+ x <- rnorm(n,mu,sig)
+ y <- dnorm(x,mu,sig)
+ plot(x,y)
+ }
> norm(1000,0,1)
Function_Plot-1
> norm <- function(n,mu,sig){
+ x <- rnorm(n,mu,sig)
+ y <- dnorm(x,mu,sig)
+ plot(x,y)
+ }
> norm(1000,10,5)
Polygon Function Plot-2
> x <- c(1,2,3,4,5,6)
> y <- c(7,4,5,9,2,8)
> x
> sort(x)
> y
> plot(x,y)
> plot(x,y,pch = 16)
> par("pch")
> plot(sort(x),y)
> polygon(sort(x),y,density = 12,angle = 45,border = "red")
Polygon Function Plot-1
> ###Polygon Function
> x <- c(1,4,5,2,6,3)
> y <- c(7,5,6,3,8,1)
> x <- sort(x)
> x
> y
> plot(x,y)
> polygon(x,y,density = 12,angle = 45)
Miscellaneous Local vs Global Plot
> ## Miscellaneous
> x <- c(1,4,5,2,6,3)
> y <- c(7,5,6,3,8,1)
> plot(x,y,type = "p",pch=13)
> par("pch")
qqline Plot-2
> beaver1
> attach(beaver1)
> search()
> qqnorm(temp)
> qqline(temp,col="red")
> qqnorm(temp)
> qqline(temp,col="red")
> par(col.main=colors()[453],col.lab=colors()
511],col.axis=colors()[575])
> qqnorm(temp)
> qqline(temp,col="blue")
> par(col.main=rainbow(5,0.6,0.75)[1],col.lab=rainbow(5,0.6,0.75)[3],col.axis=rainbow(5,0.6,0.75)[5])
> qqnorm(temp)
> qqline(temp,col=rainbow(5,0.6,0.75)[4])
qqline Plot-1
> beaver1
> attach(beaver1)
> search()
> qqnorm(temp)
> qqline(temp,col="red")
Color Plot-1
> colors()[3:5]
> colors()[363]
> class(colors())
> palette()
> typeof(palette())
> rainbow(10,s=0.6,v=0.75)
> x <- rnorm(1000,10,5)
> y <- dnorm(x,10,5)
> par(ann="FALSE")
> plot(x,y)
> ## change Graf Color
> par(fg=palette()[6])
> plot(x,y)
> title(main = "Normal dist (mu=10,sig=5)",xlab = "Variable",ylab = "Probability")
> ## Background color Change
> par(bg=palette()[8])
> plot(x,y)
> title(main = "Normal dist (mu=10,sig=5)",xlab = "Variable",ylab = "Probability")
Text qqPlot-7
> lynx
> length(lynx)
> y <- rexp(114,1.4)
> qqplot(lynx,y)
Text Plot-6
> x <- rnorm(1000,10,5)
> y <- dnorm(x,10,5)
> par(family = "HersheyGothicEnglish")
> plot(x,y)
> title(main = "Normal Distribution - Bell Curve",xlab = "Random Variable",ylab = "PDF")
> ## change Language
> ?par
> par(family = "HersheySans")
> plot(x,y)
> title(main = "Normal Distribution - Bell Curve",xlab = "Random Variable",ylab = "PDF")
> ## Again Change language
Text Plot-5
> x <- rnorm(1000,10,5)
> y <- dnorm(x,10,5)
> plot(x,y)
> par(ann="TRUE")
> plot(x,y)
> par(ann="FALSE")
> plot(x,y)
> par(cex=1.3)
> title(main = "Normal Distribution - Bell Curve",xlab = "Random Variable",ylab = "PDF")
> par(cex.main=1,cex.lab=1.5,cex.axis=0.5)
> plot(x,y)
> title(main = "Normal Distribution - Bell Curve",xlab = "Random Variable",ylab = "PDF")
Text Plot-4
> x <- rnorm(1000,10,5)
> y <- dnorm(x,10,5)
> plot(x,y)
> par(adj=0)
> title(main = "Normal Distribution - Bell Curve",xlab = "Random Variable",ylab = "PDF")
> par(adj=1)
> plot(x,y)
> title(main = "Normal Distribution - Bell Curve",xlab = "Random Variable",ylab = "PDF")
> par(adj=0.5)
> plot(x,y)
> title(main = "Normal Distribution - Bell Curve",xlab = "Random Variable",ylab = "PDF")
Text Plot-3
> x <- rnorm(1000,10,5)
> y <- dnorm(x,10,5)
> plot(x,y)
> title(main = "Normal Distribution - Bell Curve",xlab = "Random Variable",ylab = "PDF")
> mtext("Generated using rnorm",line = 4,side = 1,cex = 0.9)
> mtext("Generated using rnorm",line = 2,side = 1,cex = 0.9)
Text Plot-2
> plot.new()
> plot.window(xlim = c(0,10),ylim = c(0,5))
> axis(1)
> axis(2)
> x <- 1:5
> y <- 2*x
> plot(x,y)
> text(x,y,paste("p",x,sep = ""),pos = 2,cex = 1.2)
Text Plot-1
> par(ann="FALSE")
> x <- rnorm(1000,10,5)
> y <- dnorm(x,10,5)
> plot(x,y)
> title(main = "Normal Distribution - Bell Curve",xlab = "Random Variable",ylab = "PDF")
Axes Pressure Plot-7
> pressure
> attach(pressure)
> pressure
> plot(temperature,pressure)
> plot(temperature,pressure,bty='7')
> plot(temperature,pressure,bty='c')
> plot(temperature,pressure,bty='[')
> plot(temperature,pressure,bty=']')
Axes Plot-6
> x <- rnorm(1000,10,5)
> y <- dnorm(x,10,5)
> plot(x,y)
> par(tck = -0.01)
> plot(x,y)
> plot(x,y,bty='n')
> ## Show off Down Line
> par(xaxt='n')
> plot(x,y,bty='n')
> ## Show off Left Side Line
> par(xaxt='n',yaxt='n')
> plot(x,y,bty='n').
> ## Show On Both Lines
> par(xaxt='s',yaxt='s')
> plot(x,y,bty='n')
Axes Plot-5
> x <- rnorm(1000,10,5)
> y <- dnorm(x,10,5)
> plot(x,y)
> plot(x,y)
> par(lab=c(5,5,1))
> plot(x,y)
> ###Create A full Screen LInes(Grade)
> par(tck=1)
> plot(x,y)
> ## No Grade on the plot
> par(tck=0)
> plot(x,y)
> ## Half Grade on the plot
> par(tck=0.5)
> plot(x,y)
> ## Negative Grade on the plot for the out of Area
> par(tck=-0.5)
> plot(x,y)
Axes Plot-4
> x <- rnorm(1000,10,5)
> y <- dnorm(x,10,5)
> plot(x,y)
> plot(x,y,bty='n')
> plot(x,y,bty='7')
> plot(x,y,bty='c')
> plot(x,y,bty='[')
> plot(x,y,bty=']')
> plot(x,y,bty='u')
> par(lab=c(25,25,1))
> plot(x,y,bty='n')
Axes Plot-3
> x <- rnorm(1000,10,5)
> y <- dnorm(x,10,5)
> plot(x,y)
> plot(x,y,bty='n')
> plot(x,y,bty='7')
> plot(x,y,bty='c')
> plot(x,y,bty='[')
> plot(x,y,bty=']')
> plot(x,y,bty='u')
> par(lab=c(10,10,1))
> plot(x,y,bty='n')
Axes Plot-2
> x <- rnorm(1000,10,5)
> y <- dnorm(x,10,5)
> plot(x,y)
> plot(x,y,bty='n')
> plot(x,y,bty='7')
> plot(x,y,bty='c')
> plot(x,y,bty='[')
> plot(x,y,bty=']')
> plot(x,y,bty='u')
> par(lab=c(2,2,1))
> plot(x,y)
> plot(x,y,bty='n')
Axes Plot-1
> x <- rnorm(1000,10,5)
> y <- dnorm(x,10,5)
> plot(x,y)
> plot(x,y,bty='n')
> plot(x,y,bty='7')
> plot(x,y,bty='c')
> plot(x,y,bty='[')
> plot(x,y,bty=']')
> plot(x,y,bty='u')
Formating Plot
> x <- rnorm(1000,10,5)
> y <- dnorm(x,10,5)
> x1 <- rt(1000,20)
> y1 <- dt(x1,20)
> x2 <- runif(1000,2,4)
> y2 <- dunif(x2,2,4)
> x3 <- rexp(1000,1.5)
> y3 <- dexp(x3,1.5)
> par(mfrow=c(2,2))
> plot(x,y)
> plot(x1,y1)
> plot(x2,y2)
> plot(x3,y3)
Arrow Line-Plot
x <- sort(rexp(10,1.5))
y <- dexp(x,1.5)
plot(x,y)
lines(x,y,lwd=5)
> x0 <- x[1:9]
> y0 <- y[1:9]
> x1 <- x[2:10]
> y1 <- y[2:10]
> arrows(x0,y0,x1,y1,length = 0.2,angle = 30,code = 2)
Simple Line-Plot
> x <- sort(rexp(10,1.5))
> y <- dexp(x,1.5)
> plot(x,y)
> lines(x,y,lwd=5)
> plot(x,y)
> lines(x,y)
Window Line-Plot
> x0 <- rep(4,7)
> y0 <- rep(0,7)
> x1 <- c(0,0.535898,2,4,6,7.64012,8)
> y1 <- c(0,2,3.64102,4,3.64012,2,0)
> plot.new()
> plot.window(xlim = c(0,10),y=c(0,5))
> axis(1)
> axis(2)
> arrows(x0,y0,x1,y1,length = 0.2,angle = 30,code = 2)
Segment Plot
> x0 <- rep(4,7)
> y0 <- rep(0,7)
> x1 <- c(0,0.535898,2,4,6,7.64012,8)
> y1 <- c(0,2,3.64102,4,3.64012,2,0)
> plot(x1,y1)
> segments(x0,y0,x1,y1)
Adding Straingth Line
> x <- sort(rnorm(50,10,5))
> y <- dnorm(x,10,5)
> plot(x,y)
> abline(0.02,0.004)
> abline(h=0.04)
> abline(v=10)
> abline(coef = c(0.16,-0.02))
Line Width-Plot
> x1 <- sort(rnorm(50,10,5))
> y1 <- dnorm(x1,10,5)
> x2 <- c(-5,0,5,10,15,20)
> y2 <- c(rep(0.05,6))
> par(lwd=1)
> plot(x1,y1,type = 'o')
> par(lwd=5)
> lines(x2,y2)
Dotted and Dashed Lines Plot
> x1 <- sort(rnorm(50,10,5))
> y1 <- dnorm(x1,10,5)
> plot(x1,y1,type = 'p')
> lines(x1,y1)
>
> par(mfrow=c(2,2))
> par(lty=0)
> plot(x1,y1,type = 'n')
>
> lines(x1,y1)
> par(lty=1)
> plot(x1,y1,type = 'n')
> lines(x1,y1)
>
> par(lty=2)
> plot(x1,y1,type = 'n')
> lines(x1,y1)
>
> par(lty=3)
> plot(x1,y1,type = 'n')
> lines(x1,y1)
Adding Line-Plot-1
> x1 <- sort(rnorm(50,10,5))
> y1 <- dnorm(x1,10,5)
> plot(x1,y1,type = 'p')
> lines(x1,y1)
CoPlot-1
> rock
> attach(rock)
> coplot(area~peri|perm,data=rock,col = "red",bar.bg = c(fac="light blue",num="light green"),xlab=c("Perimeter","Permeability"),ylab = "Area",rows = 3,columns = 2,number = 6,overlap = 0.1)
## Change Row, Columns, Number and Overlap
> coplot(area~peri|perm,data=rock,col = "red",bar.bg = c(fac="blue",num="green"),xlab=c("Perimeter","Permeability"),ylab = "Area",rows = 2,columns = 3,number = 5,overlap = 0.2)
Plot
> lynx
## Check Length
> length(lynx)
> x <- rexp(114,1.4)
> qqplot(lynx,x)
> par(mfrow=c(1,1))
> qqplot(lynx,x)
## Change Rate
> x <- rexp(114,1.3)
> qqplot(lynx,x)
AirQuality Plot
> attach(airquality)
> airquality
> par(mfrow=c(2,2))
> plot(Ozone~Solar.R+Wind+Temp)
Mtcars CYL
> mtcars
> attach(mtcars)
> search()
> plot(as.factor(cyl),hp)
> par(mfrow=c(1,1))
> plot(as.factor(cyl),hp)
Faithful Plot
> faithful
> attach(faithful)
> search()
> plot(eruptions,waiting)
> plot(waiting,eruptions)
> par(mfrow=c(2,2))
> plot(waiting,eruptions)
> plot(eruptions,waiting)
QQ Plot Strat Line
> x <- rnorm(1000)
> y <- rt(1000,20)
> qqplot(x,y)
> par(mfrow=c(1,1))
> qqplot(x,y)
> y1 <- rexp(1000,1.5)
> qqplot(x,y1)
> y2 <- runif(1000,0,1)
> qqplot(x,y2)
Paires of iris
> pairs(iris[1:4])
## Add Color (RGB)
> pairs(iris[1:4],pch=21,bg=c('red','green3','blue'[unclass(iris$Species)])
## Change Label
> pairs(iris[1:4],pch=21,bg=c('red','green3','blue'[unclass(iris$Species)],labels = c('Sepal Length','Sepal Width','Petal
Length','Petal Width'))
Rock-Plot
> rock
> plot(rock)
> plot(~rock$area+rock$peri+rock$shape)
> plot(rock$area~rock$peri+rock$shape)
Hit <Return> to see next plot:
Hit <Return> to see next plot:
> par(mfrow=c(2,2))
> plot(rock$area~rock$peri+rock$shape)
Hit <Return> to see next plot:
PlantGroth
> PlantGrowth
> plot(PlantGrowth$group,PlantGrowth$weight)
MultiVarite Plot-1
> x <- rnorm(1000,0,1)
> y <- dnorm(x,0,1)
> plot(x,y)
> x <- seq(1,5,0.5)
> y <- seq(2,10,1)
> plot(x,y)
> plot(x,y,type = 'l')
> plot(x,y,type = 'o')
> plot(x,y,type = 'c')
> plot(x,y,type = 'b')
> plot(x,y,type = 's')
> plot(x,y,type = 'S')
> plot(x,y,type = 'h')
Beaver temprature QQ Plot
> beaver1
> qqnorm(beaver1$temp)
> qqline(beaver1$temp,col='red')
> plot(density(beaver1$temp))
QQ Plot Example
> qqnorm(lynx)
> qqline(lynx,col='red')
Histogram Sample
> x <- rnorm(100,10,5)
> hist(x,freq = F)
> hist(x,freq = F,breaks = seq(-5,25,2))
Density-2
> x <- rexp(1000,1.5)
> plot(density(x))
Dencity-1
--------Check density--------------
> density(x)
> plot(density(x))
> x <- rnorm(1000,0,1)
> plot(density(x))
QQ Norm QQ Line
> x <- rnorm(1000,10,5)
> qqnorm(x)
--------Add a Color-------------
> qqline(x,col='blue')
,
> y <- rexp(1000,1.5)
> qqnorm(y)
> qqline(y,col='red')
> x = rt(1000,10)
> qqnorm(x)
> qqline(x,col='red')
Box-Plot
> boxplot(iris$Sepal.Length)
--------Add Notch----------------
> boxplot(iris$Sepal.Length,notch = T)
-------------Add Boxwex-------------------
> boxplot(iris$Sepal.Length,boxwex=0.5)
-----------Change Boxwex Frequency-----------------
> boxplot(iris$Sepal.Length,boxwex=1,stoplewex=0.5)
--------------Change Stoplewex-----------
> boxplot(iris$Sepal.Length,boxwex=1,stoplewex=1)
--------------Again Change-------------------
> boxplot(iris$Sepal.Length,boxwex=1,stoplewex=0.5)
----------------Specifies Changes--------------------
> boxplot(iris$Sepal.Length,range = 0.5)
Hostogram of iris
------------History of iris Sepal Length------------------
> hist(iris$Sepal.Length)
------------Change Frequency---------------------------
> hist(iris$Sepal.Length,freq = F)
-------------Add Bricks------------------------------------
> hist(iris$Sepal.Length,freq = F)
--------------------Include Lowest True------------------
> hist(iris$Sepal.Length,breaks =seq(4,8,0.25),include.lowest = T)
----------Change Value and Shade histogram----------------
> hist(iris$Sepal.Length,breaks = seq(4,8,0.25),include.lowest = T,density = 12,angle = 45)
PieChart-1
> pie(mtcars)
> pie(mtcars$disp[1:8],labels = rownames(mtcars),col = rainbow(length(mtcars$disp[1:8])),radius=1,main="Motor Trend Engine Displacements")
-----------------Chage radius-------------------
> pie(mtcars$disp[1:8],labels = rownames(mtcars),col = rainbow(length(mtcars$disp[1:8])),radius=1.5,main="Motor Trend Engine Displacements")
-----------------edges------------------
> pie(mtcars$disp[1:8],labels = rownames(mtcars),col = rainbow(length(mtcars$disp[1:8])),radius=1.5,main="Motor Trend Engine Displacements",edges = 8)
Score of Student by Class
> x <- matrix(c(79,82,90,24,74,87,96,100,87,57,42,69),nrow = 3)
> x
> rownames(x) <- c("Paul","Mary","Ryan")
> colnames(x) <- c("History","Science","Math","Shop")
> x
> barplot(x,beside = f,legend.text = T,col = rainbow(3,s=0.6,v=0.75),main = "Score of student by class",xlab = "Class",ylab = "Score")
Car Displacement
> mtcars
> barplot(mtcars$disp[1:10],space = 1,cex.names = 0.7,main = "Motor Trend Engine Displacement",xlab = "Cars",ylab = "Displacement",col = rainbow(10,s=0.6,v=0.75),names.arg = rownames(mtcars)[1:10],offset = 0)
AirPassenger-Plot
> search()
> AirPassengers
> AirPassengers[67:124]
> plot(AirPassengers[67:124])
> x <- ts(AirPassengers[67:124],start = c(1953,9),frequency = 12)
> x
Plots-1
Create a number for 36 number 10 steps 5 times.
> x <- rnorm(36,10,5)
> y <- ts(x,start = c(2010,1),frequency = 12)
> y
Y create a Output.
and Plot the Graphic type.
> plot(y,bty="n",type="o")
Simple-Plots-1
First Create a x Values.
> x <- c(1,2,3,5,7,4,2,8,9,6,3,5,7,9,1,2,4,7,9,2)
> x
Then x is Output Generate.
> plot(x)
Plot a simple digramatic square and putting in the dotted.
> plot(x,type = "o")
Putting the dotted points on the line for graphic role.
> plot(x,type = "o",bty="n",lab=c(20,20,0))
And Last for all and full detail create a Diagram.
Bar Plot-1
------------Bar Plot------------
> x <- c(rep("A",5),rep("B",8),rep("A",7),rep("c",9),rep("B",3),rep("c",11))
> x <- as.factor(x)
> x
OUTPUT:-
[1] A A A A A B B B B B B B B A A A A A A A c c c c c c
[27] c c c B B B c c c c c c c c c c c
> plot(x,col="red")
Unvarite_Plots-1
> x <- rnorm(36,10,5)
> y <- ts(x,start = c(2010,1),frequency=12)
> y
OUTPUT:-
Jan Feb Mar Apr
2010 11.5608453 6.1589870 20.4007663 4.2887417
2011 7.1921044 9.9354474 5.7797812 14.4953509
2012 5.6980310 9.2185289 6.3580236 11.9700260
May Jun Jul Aug
2010 4.9041373 3.9988906 16.7029132 11.8652229
2011 7.1386963 10.2389375 11.0882117 13.3936695
2012 11.6263919 7.7089671 15.3836446 0.5526164
Sep Oct Nov Dec
2010 6.9586304 8.4105742 10.0549318 8.5733180
2011 10.6021607 9.9105310 8.7383487 9.9640393
2012 4.9894795 10.5967083 17.3106331 9.0455906
> plot(y,type="o",bty="n")
Plot
--------------Tree Models Exampale----------
> PlantGrowth
> search()
> attach(PlantGrowth)
> search()
> PlantGrowth
> PG.form <- group~weight
> PG.tree <- rpart(PG.form,PlantGrowth)
> PG.tree
> plot(PG.tree)
> text(PG.tree,cex=0.7)
> PG.tree <- rpart(PG.form,PlantGrowth,control = rpart.control(minsplit = 4))
> plot(PG.tree)
> text(PG.tree,cex=0.7)
> PG.tree
Plot
>search()
>iris
>?rpart
>IRIS.form <- Species~Sepal.Length+Sepal.Width+Petal.Length+Petal.Width
>IRIS.tree <- rpart(IRIS.form,iris)
>IRIS.tree
>summary(IRIS.tree)
>plot(IRIS.tree)
>text(IRIS.tree,cex=0.7)
# Some Changes
>IRIS.tree <- rpart(IRIS.form,iris,control = rpart.control(minsplit = 4,cp=0.0001))
>plot(IRIS.tree)
>text(IRIS.tree,cex=0.7)
>