Module 2 Lesson 2 Application

Author

Jamal Rogers

Published

May 17, 2023

Let’s load the tidyverse to begin.

library(tidyverse)
diamonds |>
        ggplot() +
        geom_bar(aes(x = cut, fill = color)) +
        labs(
                x = "Different cuts of diamonds",
                y = "Number of diamonds",
                fill = "Color Class",
                title = "Different Color Classfication of Diamonds based on Cuts",
                subtitle = "50,000 round cut diamonds",
                caption = "dataset from ggplot2 package"
        ) +
        scale_fill_discrete() +
        annotate(
                geom = "label", x = 1.0, y = 18000,
                label = "Fairly distributed color classification on different cuts",
                hjust = "left",
                color = "blue"
                ) +
        theme_bw() +
        theme(legend.position = "bottom")

ggsave("application.png")