Professional Documents
Culture Documents
As
As
EX:
A<-c(17,32,8,53,1)
barplot(A,xlab="x-axis",ylab="y-axis",main="Bar-chart")
OUTPUT
A<-c(17,32,8,53,1)
barplot(A,xlab="x-axis",ylab="y-axis",main="Bar-chart",horiz=T)
OUTPUT
#Creating data for the chart
A<-c(17,32,8,53,1,22)
B<-c("jan","feb","mar","apr","may","jun")
barplot(A,xlab="months",ylab="articles",main="article-chart",names.arg = B,col="black")
OUTPUT
EXAMPLE 1
A<-matrix(c(17,32,8,53,1,22,76,98,89,90,94,96,87,54,78),nrow=3,ncol=5,byrow=T)
B<-c("math","chem","phy","eng","social",)
legend("topleft",subject,cex=1.5,fill=colors)
OUTPUT
EXAMPLE 2
A<-matrix(c(17,32,8,53,1,22,76,98,89,90,94,96,87,54,78),nrow=3,ncol=5,byrow=T)
B<-c("math","chem","phy","eng","social")
legend("topleft",subject,cex=1.5,fill=colors)
EXAMPLE 3
A<-matrix(c(17,32,8,53,1,22,76,98,89,90,94,96,87,54,78),nrow=3,ncol=5,byrow=T)
B<-c("math","chem","phy","eng","social")
legend("topleft",subject,cex=1.5,fill=colors)
EXAMPLE 4
A<-matrix(c(17,32,8,53,1,22,76,98,89,90,94,96,87,54,78),nrow=3,ncol=5,byrow=T)
B<-c("math","chem","phy","eng","social")
legend("topleft",subject,cex=1.5,fill=colors)
Creating pie-chart
A<-c(50,100,200,500)
B<-c("math","chem","phy","eng",)
pie(A,B)
OUTPUT
Pie chart including the title and colors
geeks<-c(100,150,200,250)
labels<-c("math","chem","phy","eng")
pie(geeks,labels,main="obtained marks",col=rainbow(length(geeks)))
OUTPUT
geeks<-c(100,150,200,250)
labels<-c("math","chem","phy","eng")
piepercent<-round(100*geeks/sum(geeks),1)
pie(greeks,labels,main="obtained marks",col=rainbow(length(greeks)))
legend("topright",c("math","chem","phy","eng"),cex=1.5,fill=rainbow(length(geeks)))
OUTPUT
v<-c(32,45,65,47,55,57,54,66,67,68,71,72,73,74,89,85,86,83,82,91,98,95,97,93,96)
hist(v,xlab="No of articles",col="green",border="black")
OUTOUT
Ranges of X and Y valuesv<-c(19,23,11,5,16,21,32,14,19,27,39)
hist(v,xlab="No of articles",col="green",border="black",xlim=c(0,50),ylim=c(0,5),breaks=5)
OUTPUT
EXERCISE PROBLEM
program
a<-c(234,345,321,543,346,456,775)
barplot(a,xlab="x-axis",ylab="y=axis",main="bar-char")
OUTPUT
2.Draw a bar chart along with titles and labels for the following data:
23,34,54,12,45 and 62
program
a<-c(23,34,54,12,45,62)
b<-c("math","chem","eng","eco","phy","social")
OUTPUT
3. Draw a horizontal and vertical bar chart with titles,labels and colors for the following data:
program
a<-c(112,134,135,165,189,192)
b<-c("math","chem","eng","eco","phy","social")
OUTPUT
VERTICAL
HORIZONTAL
a<-c(112,134,135,165,189,192)
b<-c("math","chem","eng","eco","phy","social")
OUTPUT
a<-c(12,19,23,34,42)
b<-c("Ramu","Sajjad","Dewans","Prajwal","Raj")
pie(a,b)
OUTPUT
23,35,34 and 53
program
library(plotrix)
slices<-c(23,35,34,53)
lbls<-c("A","B","C","D")
OUTPUT
6. Following table shows the fequency distribution of college student according to their pocket money
(daily).Draw histogram and fequency polygon on the same graph paper.
program
midx<-seq(5,65,10);
frequency<-c(15,34,15,17,11,13,12);
x<-rep(midx,frequency);
brk<-seq(0,70,10);
OUTPUT
7.Create the histogram graph for the following data: 2,14,24,36,48,61,18 and 55
v<-c(2,14,24,36,48,61,18,55)
hist(v,xlab="No.of article",col="gray",border="white")
OUTPUT