Factors, Amounts, & Proportions

Due: Oct 12 by 11:59pm

Weight: This assignment is worth 1% of your final grade.

Purpose: The purpose of this assignment is to turn the data visualization best practices from class into a custom agent skill that you design, then use that skill to make a “good” chart of amounts or proportions. Along the way, you will learn enough about factors and facets to check whether your agent got the details right.

Assessment: This assignment is graded using a check system:

  • ✔+ (110%): Responses shows phenomenal thought and engagement with the course content. I will not assign these often.
  • ✔ (100%): Responses are thoughtful, well-written, and show engagement with the course content. This is the expected level of performance.
  • ✔− (50%): Responses are hastily composed, too short, and/or only cursorily engages with the course content. This grade signals that you need to improve next time. I will hopefully not assign these often.

Notice that this is essentially a pass/fail system. I’m not grading your writing ability and I’m not counting the number of words you write - I’m looking for thoughtful engagement. One or two sentences is not enough. Write at least a paragraph and show me that you did the readings assigned.

1. Get Organized

Open your course repo (eda-f26/eda-netID) in Positron using File › Open Folder - open the folder itself, not a file inside it. If you haven’t cloned your course repo yet, follow the steps in HW1 first.

Everything for this assignment lives in the hw6 folder. Open the hw6.qmd file inside it - that’s the only file you need to edit. Take notes and write example code under the “Begin notes here” heading as you go through the readings and exercises below, then write your reflection under the “Reflection” heading at the end.

2. Read & Practice

The readings listed below are broken into two groups:

  1. Design principles
  2. Coding techniques to implement those principles

Design principles

The design principles discussed in the following readings repeat many of the concepts we saw last week, except focused on the particular subset of charts for this week:

Coding techniques

The readings below cover two things that show up constantly in charts of amounts and proportions: factors & facets. Factors are how R stores categorical variables, and they control the order in which categories appear in a chart. An agent will happily hand you bars sorted alphabetically, which is almost never what you want, so you need to know enough about factors (and the forcats package) to spot when the order is wrong and to ask for the right fix. Facets are the ggplot version of the “small multiples” we saw in class: one chart split into panels, which is often a better option than stacking bars or adding more colors.

3. Build a skill, then make a chart

In week 2 you tried out the my-chart-style skill that I wrote. This week you will design your own skill around good data visualization practices, then use it to make a chart.

Build your skill

The end of the Visualizing Information slides contains two things that make great raw material for a skill:

  • The 10 data viz best practices (remove chart junk, don’t stack bars, rotate and sort categorical axes, directly label geoms, etc.).
  • The “Making a (good) ggplot” example, which walks step by step from a default bar chart to a finished one.
  1. Open Claude Code in your course repo and point it to the slides URL above. Ask it to help you create a skill that encodes those best practices and the steps for making a good chart. Save the skill in .claude/skills/ in your course repo (e.g., .claude/skills/my-dataviz/SKILL.md).
  2. Read what it wrote. Does the skill actually capture the best practices from class? Did it leave anything out, or add rules that weren’t in the slides?
  3. Make it yours. Edit the skill (directly, or by asking Claude to) to customize it. For example, pick a color palette and theme you like, set your own rules for titles and captions, or add guidance for when a pie chart or stacked bar is acceptable.

Use your skill to make a chart

Find a dataset with at least one categorical variable. You can use one from the Packages section of the “Finding Data” page, or data from your project. Then ask Claude to make a chart of amounts or proportions using your skill (invoke it with /your-skill-name).

Check the result against the best practices. In particular, look closely at the factors: are the categories in a meaningful order, or just alphabetical? Are any categories missing, mislabeled, or lumped together in a way that hides something important? If something is wrong, fix it, and consider whether your skill should be updated so that it gets it right next time.

In your hw6.qmd file, include:

  • The name and location of your skill (the skill file itself will be in your repo when you submit).
  • A few sentences on what you changed after Claude drafted the skill, and why.
  • The chart you made with your skill, with one or two sentences under it describing what it shows.
  • A few sentences on how it went: Did the chart follow your skill on the first try? What did you have to check, correct, or change in the skill?

4. Reflect

This week, consider writing about a chart you’ve seen that shows amounts or proportions (like a bar chart, or a parts-of-a-whole figure).

Reflect on what you’ve learned while going through these readings and exercises. Is there anything that jumped out at you? Anything you found particularly interesting or confusing?

Write at least a paragraph in your hw6.qmd file, and include at least one question. The teaching team will review the questions we get and will try to answer them either in Slack or in class.

Some thoughts you may want to try in your reflection:

  • “I used to think ______, now I think ______ 🤔”
  • Discuss some of the key insights or things you found interesting in the readings or recent class periods.
  • Connect the course content to your own work or project you’re working on.

5. Submit

To submit your assignment, follow these instructions:

  1. Render your .qmd file by either clicking the “Preview” button in Positron or running quarto render in the terminal.
  2. Open the rendered html file and make sure it looks good! Is all the formatting as you expected?
  3. Commit and push your work using GitHub Desktop: look at the diff, write a short commit message, click Commit, then Push.
NoteRemember

Your work isn’t submitted until you’ve pushed it. Committing only saves the change on your own computer – go look at your repo on GitHub.com and confirm your work is actually there before you call this done.