Professional Documents
Culture Documents
Datascience
2) Please write the command for plotting the graph between weight and bloodpressure
plot(weight,bp,
main="WEIGHT VS BLOODPRESSURE",
sub="relation between weight and bloodpressure",
col="black",
pch=25)
R consists of hard coding,moderate coding
and has gui based interface which is called r
commander
1)cex->size of text
2)pos->position
3)c->colour
text(weight,bp,cex=0.6,pos=1,col="black")
text(weight,bp,locality,cex=0.9,pos=2,col="r
ed")
text(wight,bp,weight,cex=0.7,pos=3,col="blu
e")
text(weight,bp,bp,cex=0.6,pos=4.col="green"
)
plot(bp~weight)
points(bp[tumour=="small"]~weight[tumour=="small"],
main="weight vs. bp",
xlab="weight",ylab="bp",col="black",pch=16)
points(bp[tumour=="large"]~weight[tumour=="large"],
main="weight vs. bp",
xlab="weight",ylab="bp",col="red",pch=24)
3)Please write the command for creating stacked chart between smoking
and tumour
counts<-table(smoking,tumour)
counts
barplot(counts,
main="stacked chart of smoking and tumour",
xlab="smoking",
ylab="%",
names.arg=c("large","small"),col=c("pink","skyblue"),
legend=rownames(counts),space=1,beside=F)
grid()
mosaicplot(counts,col=c("pink","lightgreen"))