How bad has 2025 been for the US Dollar? Is this picture worth 1000 words?


Hey folks!

I posted two videos last week! On Monday I posted a video critiquing the diverging bar plot that I described in this newsletter last Friday. My goal in this video was to think through a “constructive” approach to interpreting and critiquing data visualizations. As scientists, I think we are too worried about hurting each other’s feelings. So we don’t critique each other. At the same time, many of us think before we speak and can come off overly harsh. My goal is to create a framework where we can think and then speak and accept feedback as coming from someone that wants us to be trying to improve. Alas, not many people watched the critique video! Those who watched it and commented were pretty positive about it. So, it would be great to get more views, shares, and comments to help the algorithm offer those types of videos to people. Monday’s video was about 30 minutes long. I’d love to get them to be about 15-20 minutes. On Wednesday I posted a livestream where I did my best to recreate the plot in R with ggplot2. I’d love to get into this cadence of posting content for you all. If you have a plot you’d like to see me critique and recreate, please send it my way.


This week, I have a version of a figure that John Taylor sent my way. This comes from an article in the Financial Times. John sent me a dark mode version of what the FT published on their site. I’m going to try to recreate the “light” mode version. Maybe you all could take it as a challenge to make that dark version on your own:

Since I’ll present the critique on Monday, let’s focus on how I’d plan on doing this in R. First off, what is it? It’s a line plot where each line represents a different year. The y-axis is the percent change in the US Dollar Index for the year leading up to September 18th. The data for 2025 is shown in red.

To generate the plot, we’re going to need data. We’re told in the lower right corner that the source is “LSEG, FT calculations”. I’ve learned not to go back to the reporter for data. I’ve never gotten anything by that approach! What is LSEG? From their website, I learned, “LSEG is a leading global financial infrastructure and data provider. We play a vital social and economic role in the world’s financial system.” Eh. I’m not sure how I’ll get data out of them either. Let’s try googling “US Dollar Index”. Voilà! Clicking on the link for yahoo! finance we can see the US Dollar Index is an ETF that people can invest in.

This reminds me of a newsletter and video from a while back where I recreated a plot showing the change in the S&P500 over the first months of the current Trump administration. I was able to get the S&P500 data using the {quantmod} R package. Thankfully, I still have the code for that visualization and suspect I can adapt it to get the data for the US Dollar Index. I’m pretty sure I can get the data I want by using quantmod::getSymbols("DX-Y.NYB", auto.assign = FALSE). That will generate a data frame with the date, and the daily low, high, open, and closing price. I’d likely focus on the date and the closing price.

To generate the lines, I’d use something like geom_line(). On the x-axis I’d plot the date. This type of thing proves to be a bit tricky because most years have 365 days and some (like 2024) have 366 days. First, I’d get the month, day, and year as separate variables using the eponymous functions from the {lubridate} package. Then I’d create a new date column using a dummy year that is a leap year - 2024 - and the month and day. This new date column would be my x-axis. Then I’d use the year as the grouping variable. To generate the data for the y-axis, I’d group the data by year and calculate the percent difference from the first day of the year with data (n.b., January 1st is a holiday and in some years the 2nd or 3rd fall on a weekend). We’d do these calculations with a mutate() using the .by = argument. This should get us a plot pretty similar to what is shown in the FT figure.

Now to style it.

First, is the red line. I’d make a dummy variable like… is_this_year, which would be TRUE for 2025 and false for all other years. I’d then map is_this_year to the color aesthetic. I’d make 2025 red and the other years the gray color. Next, I notice that those lines aren’t normal geom_line() lines. They have a linen-colored edge to them that’s the same color as the background. How do we do this? Again, I’m reminded that we pulled this off in the past using the {ggborderline} package when I recreated the Economists Glass Ceiling Index figure. Nice. We can set the interior color to be red or gray and the border to be something like linen.

Second, the right-hand margin has three years indicated, 1991, 2013, and 2025. I do not know why those years were selected. They certainly aren’t the years I would have selected. Regardless, we want to recreate the figure. I’d first use xlim with coord_cartesian() along with clip = "off" to plot data (i.e., text) outside the plotting panel. Then I’d use geom_segment() to draw the segments from the end of the three lines to where I’d place the labels using geom_text(). What lines would you want to see highlighted? For sure, I’d want to see 2025. But I’d also maybe be interested in 2024 (last year), 2020 (pandemic), 2009 (Great Recession), 2001 (9/11). I’d also want to know what year ended the strongest.

Finally, the plot has some nice horizontal lines to help orient the viewer. They have horizontal grid lines under the data which is easy enough to do using the panel.grid.major argument in theme(). They also have a dotted black line on top of the data that crosses the y-intercept at zero. We could create this with geom_hline().

Along the way there’s some other styling we might think about like the font (perhaps Libre Franklin or Noto Sans, neither gets the “1” right) and the FT logo in the bottom left corner.

Let me know what you think!

Workshops

I'm pleased to be able to offer you one of three recent workshops! With each you'll get access to 18 hours of video content, my code, and other materials. Click the buttons below to learn more

In case you missed it…

Here is a livestream that I published this week that relate to previous content from these newsletters. Enjoy!

video previewvideo preview

Finally, if you would like to support the Riffomonas project financially, please consider becoming a patron through Patreon! There are multiple tiers and fun gifts for each. By no means do I expect people to become patrons, but if you need to be asked, there you go :)

I’ll talk to you more next week!

Pat

Riffomonas Professional Development

Read more from Riffomonas Professional Development

Hey folks! As I’m writing this newsletter the US government is in shutdown mode with no clear signs that things will get going anytime soon. I’ll withhold my own political take except to say that my family has been running without an official budget for about 25 years. I don’t recommend it, but we know basically how much money goes to our mortgage, insurance, groceries, charities, etc. and how much money we generally have left over. Somehow we still are able to spend money on living a pretty...

Hey folks! This week I have a figure for you from the New York Times based on a poll they did with Siena that describes Americans’ sentiments concerning Israel’s actions in their war with Gaza. What does it say to me? This plot is saying that more Americans think that Israel is intentionally killing civilians than they did in December 2023. The change in percentage of people in the other categories seems to decrease accordingly. What do you like? I love slope plots! I think they’re a great...

Hey folks, This week I have an interesting figure for you from the Financial Times from an e-mail newsletter they distribute each week describing some visualization related to climate change. Before reading further, go ahead and spend a few minutes with the image. What does it say to you? What do you like? What don’t you like about it? How do you think you would go about making it in R? I’d encourage you to write down any of your answers to these questions before reading what I have to say....