Recently Published
Scatter plot for Fruit Sales
library(ggplot2)
ggplot(fruit_data, aes(x = Fruit, y = Sales)) +
geom_point(size = 4, color = "red") +
labs(title = "Fruit Sales (Scatter Plot)", x = "Fruit", y = "Sales Count")
Radar 3
data <- data.frame(
Communication = c(5, 4, 3, 2, 1),
Teamwork = c(4, 5, 2, 3, 1),
ProblemSolving = c(3, 4, 5, 2, 1),
Creativity = c(2, 3, 4, 5, 1)
)
data <- rbind(rep(5, 4), rep(0, 4), data)
radarchart(data, title = "Radar Chart: Employee Performance", pcol = "purple", pfcol = rgb(0.5, 0, 0.5, 0.3), plwd = 2)
Radar 2
data <- data.frame(
Product1 = c(5, 4, 3, 2, 1),
Product2 = c(4, 5, 2, 3, 1),
Product3 = c(3, 4, 5, 2, 1)
)
data <- rbind(rep(5, 3), rep(0, 3), data)
radarchart(data, title = "Radar Chart: Comparing Products", pcol = c("blue", "red", "green"), pfcol = c(rgb(0, 0, 1, 0.3), rgb(1, 0, 0, 0.3), rgb(0, 1, 0, 0.3)), plwd = 2)
Radar Chart 1
install.packages("fmsb")
library(fmsb)
data <- data.frame(
Speed = c(5, 4, 3, 2, 1),
Durability = c(4, 5, 2, 3, 1),
Reliability = c(3, 4, 5, 2, 1),
Efficiency = c(2, 3, 4, 5, 1)
)
data <- rbind(rep(5, 4), rep(0, 4), data)
radarchart(data, title = "Radar Chart: Product Attributes", pcol = "blue", pfcol = rgb(0, 0, 1, 0.3), plwd = 2)
Map (US)
us_map <- map_data("state")
ggplot(us_map, aes(x = long, y = lat, group = group)) +
geom_polygon(fill = "lightgreen", color = "black") +
theme_minimal() +
ggtitle("US State Map Example")
Maps
install.packages("maps")
install.packages("ggplot2")
library(maps)
library(ggplot2)
world_map <- map_data("world")
ggplot(world_map, aes(x = long, y = lat, group = group)) +
geom_polygon(fill = "lightblue", color = "black") +
theme_minimal() +
ggtitle("World Map Example")
Box Plot
set.seed(123)
group1 <- rnorm(100, mean = 70, sd = 10)
group2 <- rnorm(100, mean = 80, sd = 15)
group3 <- rnorm(100, mean = 60, sd = 5)
boxplot(group1, group2, group3, names = c("Group 1", "Group 2", "Group 3"), col = "orange", main = "Box Plot: Exam Scores by Group")
Waffle chart
install.packages("waffle")
library(waffle)
parts <- c(30, 20, 15, 35)
waffle(parts, rows = 5, colors = c("red", "blue", "green", "yellow"), title = "Waffle Chart: Distribution")
Radar Chart
install.packages("fmsb")
library(fmsb)
data <- data.frame(
Speed = c(5, 4, 3, 2, 1),
Durability = c(4, 5, 2, 3, 1),
Reliability = c(3, 4, 5, 2, 1),
Efficiency = c(2, 3, 4, 5, 1)
)
radarchart(data, title = "Radar Chart: Product Attributes")
Word Chart
install.packages("wordcloud")
library(wordcloud)
words <- c("Data", "Visualization", "R", "Programming", "Analysis", "Statistics", "Charts", "Graphs")
freq <- c(50, 40, 30, 25, 20, 15, 10, 5)
wordcloud(words, freq, colors = brewer.pal(8, "Dark2"), main = "Word Cloud Example")
Line Plot
time <- c(1, 2, 3, 4, 5, 6)
sales <- c(200, 220, 250, 300, 320, 350)
plot(time, sales, type = "o", col = "red", main = "Line Plot: Sales Over Time", xlab = "Time (Months)", ylab = "Sales ($)")
abline(lm(sales ~ time), col = "blue")
Scatter Plot
height <- c(160, 165, 170, 175, 180, 185)
weight <- c(60, 65, 70, 75, 80, 85)
plot(height, weight, col = "blue", pch = 19, main = "Scatter Plot: Height vs Weight", xlab = "Height (cm)", ylab = "Weight (kg)")
Pie Chart
market_share <- c(30, 25, 20, 15, 10)
labels <- c("Company A", "Company B", "Company C", "Company D", "Others")
pie(market_share, labels = labels, col = rainbow(length(labels)), main = "Pie Chart: Market Share")
Histogram
set.seed(123)
data <- rnorm(1000, mean = 50, sd = 10)
hist(data, breaks = 30, col = "lightgreen", main = "Histogram: Random Normal Distribution", xlab = "Values")