Untitled

 avatar
unknown
plain_text
2 months ago
1.1 kB
3
Indexable
# Creating a Plot
x <- c(1, 2, 3, 4, 5)
y <- c(2, 4, 1, 3, 5)
# Create a scatter plot
plot(x, y,main = "Simple Scatter Plot", xlab = "X-axis",ylab = "Y-axis", col = "blue",pch = 
16)
# Add a title and labels to the axes
title(main = "Simple Scatter Plot", col.main = "darkblue", font.main = 4)
# Creating a Histogram
data <- rnorm(1000) # Generating random data
hist(data, main="Histogram Example", xlab="Value", ylab="Frequency", col="lightblue", 

# Creating a Line Chart

x <- c(1, 2, 3, 4, 5)

y <- c(2, 4, 6, 8, 10)
plot(x, y, type="l", main="Line Chart Example", xlab="X-axis Label", ylab="Y-axis Label", 
col="red")
# Creating a Pie Chart
slices <- c(10, 20, 15, 30, 25) 
labels <- c("A", "B", "C", "D", 
"E")
pie(slices, labels, main="Pie Chart Example", col=rainbow(length(slices)))
# Creating a Box Plot

data <- c(12, 15, 18, 20, 22, 25, 30, 40, 50)

boxplot(data, main="Box Plot Example", xlab="Data", col="green", border="black")
# Creating a Scatterplot
x <- c(1, 2, 3, 4, 5)
y <- c(2, 3, 1, 4, 5)
plot(x, y, main="Scatterplot Example", xlab="X-axis Label", ylab="Y-axis Label", pch=19, 
Editor is loading...
Leave a Comment