This project showcases a series of data visualizations using R. The dataset used is [briefly describe your dataset].
ggplot(iris, aes(x = Species, y = Sepal.Length, fill = Species)) +
geom_boxplot() +
labs(title = "Sepal Length Distribution by Iris Species",
x = "Species",
y = "Sepal Length (cm)") +
theme_minimal()ggplot(economics, aes(x = date, y = unemploy)) +
geom_line(color = "blue") +
labs(title = "Unemployment Over Time",
x = "Date",
y = "Number of Unemployed") +
theme_minimal()cor_matrix <- cor(iris[, 1:4])
ggplot(data = reshape2::melt(cor_matrix)) +
geom_tile(aes(x = Var1, y = Var2, fill = value)) +
scale_fill_viridis() +
labs(title = "Correlation Heatmap of Iris Features",
x = "", y = "") +
theme_minimal()mtcars_with_names <- mtcars %>%
rownames_to_column(var = "car_name")
animated_plot <- ggplot(mtcars_with_names, aes(x = wt, y = mpg, size = hp, color = factor(cyl))) +
geom_point(alpha = 0.7) +
scale_size(range = c(2, 10)) +
labs(title = "Car Weight vs. MPG (Carburetors: {frame_time})",
x = "Weight (1000 lbs)", y = "Miles per Gallon",
color = "Cylinders", size = "Horsepower") +
transition_states(carb, transition_length = 2, state_length = 1) +
ease_aes('linear') +
theme_minimal()
animate(animated_plot, nframes = 200, fps = 20)iris_summary <- iris %>%
group_by(Species) %>%
summarize(min_length = min(Sepal.Length),
max_length = max(Sepal.Length))
ggplot(iris_summary) +
geom_segment(aes(x = min_length, xend = max_length,
y = Species, yend = Species),
color = "grey") +
geom_point(aes(x = min_length, y = Species), color = "blue", size = 3) +
geom_point(aes(x = max_length, y = Species), color = "red", size = 3) +
labs(title = "Range of Sepal Lengths by Iris Species",
x = "Sepal Length (cm)",
y = "Species") +
theme_minimal()us_states <- map_data("state")
ggplot(data = us_states) +
geom_polygon(aes(x = long, y = lat, group = group, fill = region),
color = "white") +
coord_fixed(1.3) +
guides(fill = FALSE) +
labs(title = "Map of US States") +
theme_void()bubble_chart <- ggplot(mtcars, aes(x = wt, y = mpg, size = hp, color = factor(cyl))) +
geom_point(alpha = 0.7) +
scale_size(range = c(2, 20)) +
labs(title = "Car Weight vs. MPG",
x = "Weight (1000 lbs)", y = "Miles per Gallon",
color = "Cylinders", size = "Horsepower") +
theme_minimal()
ggplotly(bubble_chart)This project demonstrates various visualization techniques in R, including interactive and animated plots. Each visualization provides unique insights into the data, showcasing different aspects and relationships within the datasets.