plot(x, y, main, xlab, ylab, xlim, ylim, axes)
#png(file = "scatterplot.png") # output file name
# plot a scatter plot
plot(x = x <- seq(-pi,pi,0.1),y = sin(x),
xlab = "Weight",
ylab = "Milage",
xlim = c(-3.5,3.5),
ylim = c(-1,1),
main = "Weight vs Milage",
type = "o",
col = "blue",
)
# add an overlap plot
points(x,cos(x), col="red")
lines(x, cos(x), col='red')
# add legend
legend("topleft",
c("sin(x)","cos(x)"),
fill=c("blue","red")
)
# output plot to the file
# dev.off()
plot(v,type,col,xlab,ylab)
plot(x = x <- seq(-pi,pi,0.1),y = sin(x),
xlim = c(-3.5,3.5),
ylim = c(-1,1),
type = "p",
col = "blue"
)
pie(x, labels, radius, main, col, clockwise)
x <- c(21, 62, 10, 53)
labels <- c("London", "New York", "Singapore", "Mumbai")
pie(x,labels, radius = 0.8, main = "Pie Chart", col = c("blue", "red", "yellow", "white"), clockwise=TRUE)
barplot(H,xlab,ylab,main, names.arg,col)
H <- c(7,12,28,3,41)
barplot(H, xlab='month', ylab='production', main='bar chart', names.arg=c('Jan', 'Feb', 'Mar', 'Apr', 'May'), col='red')
colors = c("red","blue","yellow")
months <- c("Mar","Apr","May","Jun","Jul")
regions <- c("East","West","North")
Values <- matrix(c(2,9,3,11,9,4,8,7,3,12,5,2,8,10,11), nrow = 3, ncol = 5, byrow = TRUE)
barplot(Values, main = "total revenue", names.arg = months, xlab = "month", ylab = "revenue", col = colors)
legend("topleft", regions, cex = 1.3, fill = colors)
boxplot(x, data, notch, varwidth, names, main)
a = c(5, 7, 10, 15, 19, 21, 21, 22, 22, 23, 23, 23, 23, 23, 24, 24, 24, 24, 25)
boxplot(a)
hist(v,main,xlab,xlim,ylim,breaks,col,border)
v <- c(9,13,21,8,36,22,12,41,31,33,19)
hist(v,xlab = "Weight", xlim = c(0,40), col = "yellow",border = "blue", breaks = 10)