Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make gentler intro for ggplot2 lesson #552

Closed
wants to merge 1 commit into from

Conversation

wallacelab
Copy link

This is in response to Issue #542. The current ggplot2 lesson starts very abruptly and can be confusing to novices. In my teaching, I've found that using a little time to explain the logic of ggplot a bit more helps a lot. I've also found that building up the first graphic piece by piece works better than starting with the finished graphic and then backtracking to explain how it fits together.

All changes in this pull request are in the first section of the lesson (up to but not including the first challenge). There are two main (and separate) changes that have been made:

  1. The introduction to ggplot grammar has been expanded to replace "coordinate system" with "mapping aesthetics" and explain in (slightly) more detail what each component is.
  2. The example scatterplot is built up one element at a time (first data, then aesthetics, then geom) rather than all at once.

In my experience these changes make it much easier for learners to understand how ggplot works. The major disadvantage is that it probably adds ~5 minutes of instruction time.

Inkscape.

Let's start off with an example:
built from the same set of components: a **data set**,
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change #1: Expand the explanation of how ggplot works to make it easier for novices to understand. Also replaced "coordinate system" with "mapping aesthetics" for the following reasons (from issue #542)

  • The word "coordinate" is never used again in the lesson, whereas "mapping" shows up 25 times and "aesthetic" 16 times
  • None of the examples actually change the coordinate system. (The closest is adjusting the scale with + scale_x_log10() )
  • The base ggplot() command seems to function more like a "layer 0" than a coordinate system. (This may be due to an incorrect mental map on my part, but it behaves like the base layer on which everything else is placed.)
  • This would make clearer what aes() is actually doing (mentioned briefly in issue Specify mapping in the ggplot2 episode? #473)

important aspects of the plot. The idea of layers of graphics may
be familiar to you if you have used image editing programs
like Photoshop, Illustrator, or Inkscape.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Second major change (below): Broke the first example apart so that it's built up in stages (data, aesthetics, geoms) rather than putting in a large block of code all at once. In my experience this helps learners understand better what each component is doing and how they fit together.

@@ -334,11 +348,11 @@ elements. The x-axis is too cluttered, and the y axis should read
"Life expectancy", rather than the column name in the data frame.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how the below edits happened since they didn't show up in my initial comparison. Regardless, they're just spaces at the end of the line and can be ignored.

@jcoliver
Copy link
Contributor

Thanks for the PR, @wallacelab . We're reviewing the changes.

@jcoliver jcoliver added status:in progress Contributor working on issue type:enhancement Propose enhancement to the lesson labels Aug 23, 2019
katrinleinweber pushed a commit to katrinleinweber/r-novice-gapminder that referenced this pull request Nov 20, 2019
Largely based on swcarpentry/pull/552/
resp. wallacelab/r-novice-gapminder/commit/34728875c622e2176fe9329b8cee1ef7e2a9d80b
Base automatically changed from master to main March 17, 2021 23:21
@naupaka
Copy link
Member

naupaka commented Apr 21, 2023

@wallacelab this seems like a nice PR but it's currently got a merge conflict against main. If you can make the adjustments necessary for a clean merge, I think we'd be happy to merge this in. We need to merge or close all open PRs before the end of the month (April 2023) since the primary branch structure will be changing and all existing PRs will break.

@matthieu-bruneaux
Copy link
Contributor

Thank you @wallacelab and @naupaka!

I fixed the merge conflicts from this PR using the command line (locally on my computer), and I then created a new PR (#826) that should allow for a clean merge of the content of this PR (#552).

This is my first time resolving merge conflicts via the command line and pushing back to the GitHub repo for a clean merge, please let me know if there was a simpler/preferred way to do this :)

@naupaka
Copy link
Member

naupaka commented Apr 25, 2023

Thanks @matthieu-bruneaux! I'm closing this PR and we can merge the new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:in progress Contributor working on issue type:enhancement Propose enhancement to the lesson
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants