Skip to content

Add examples from John Russell #4

Open

Description

@friendly

@drjohnrussell has an impressive collection of examples of plots for the HistData datasets, in conjunction with the 2025 30 Day Chart Challenge, https://github.com/drjohnrussell/30DayChartChallenge

It would be nice to incorporate them here, in the HistData package. At present, I've copied them to files under sandbox/.

How to proceed?

  • I don't want to add too many extra dependencies for these.
    • Change library(tidyverse) to load the minimal, e.g., ggplot2, dplyr ...
    • What to about the (nice) extrafonts?
  • For simpler graphs, use/modify the code directly in package examples,
  • For others: Perhaps create a demo/ folder to be run as demo(dataset) ?

Activity

  1. lfpdroubi commented on May 21, 2025

    @lfpdroubi
    Contributor

    I have checked challenges 1 to 3. There is no need to add tidyverse. I have changed tidyverse code for base R ones. For instance, in the chunk below I have switched mutate with transform and arrange with sort_by :

    if (require("waffle")) {
      day1 <- Cholera |>
        transform(newcholeradeaths = cholera_deaths/40) |>
        sort_by(~water) |>
        ggplot(aes(fill=water,values=newcholeradeaths)) +
        geom_waffle(radius=grid::unit(0.4,"npc"),
                    size=.25) +
        theme_void() +
        labs(title="Deaths from Cholera in London in 1849",
             subtitle="40 Deaths per Square",
             caption="Data from William Farr's initial report, where he concluded
             elevation \nwas the factor in the spread of plague",
             fill="Water Source") +
        scale_fill_brewer(palette="Dark2") +
        theme(legend.position="bottom",
              panel.background=element_rect(color="white"))
    
    day1
    }
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions