Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
1.0 kB
2
Indexable
Never
#Scatter Plot
#Generate Data
gridx<-seq(0,1,length=50)
fx=sin(2*pi*gridx)
sin_data=data.frame(gridx,fx)
#Create Scatter Plot
plot(x=sin_data$gridx, y=sin_data$fx, type="p", main="Scatter plot for sin(2*pi*x)", col="Red", xlab='x', ylab='y', pch=7)

#Line Plot
plot(x=sin_data$gridx, y=sin_data$fx, type="l", main="Scatter plot for sin(2*pi*x)", col="Red", xlab='x', ylab='y')

#Other Plots
plot(x=sin_data$gridx, y=sin_data$fx, type="b", main="Scatter plot for sin(2*pi*x)", col="Red", xlab='x', ylab='y')
plot(x=sin_data$gridx, y=sin_data$fx, type="s", main="Scatter plot for sin(2*pi*x)", col="Red", xlab='x', ylab='y')

#Box Plot
x<-rnorm(500, mean=10,sd=2)
boxplot(x, col="blue", border="red", xlab='X values', ylab='Y values', main="Box Plot")

#Bar Chart
#Generate Revenue Data
x<-c(17,10,15,23,29)
y<-c("Mar","Apr","May","Jun","Jul")
#Create the Bar Chart
barplot(x, names.arg=y, xlab="Month", ylab="Revenue", main ="Bar Chart", col="grenn", border="red", ylim=c(0,30))
Leave a Comment