First post
Building a ggplot Visualization
Basic Plot Setup
Set up the basic plot area with axes.
ggplot(mtcars, aes(x = wt, y = mpg))
Step 1 of 4
Creating a GGPlot Visualization
Load Libraries
First, we load the necessary libraries: ggplot2 for plotting and palmerpenguins for the dataset.
library(ggplot2)library(palmerpenguins)data(penguins)ggplot(penguins, aes(x = flipper_length_mm, y = body_mass_g, color = species)) + geom_point() + scale_color_manual(values = c("darkorange", "purple", "cyan4")) + theme_minimal()
Step 1 of 5
Data Manipulation with mtcars Dataset
Load Libraries
First, we load the tidyverse library for data manipulation.
library(tidyverse)mtcars |> select(mpg, hp) |> rownames_to_column(var = "car") |> mutate(kmpl = mpg * 0.425144) |> arrange(desc(kmpl)) |> filter(hp > 100)
Step 1 of 5