Recreating a
dumbbell plot
November 26, 2024
This week I recreated a dumbbell plot from the New York Times on interstate moves in the United States and their relationship to election results. Ronda Kaysen and Ethan Singer participated in its creation.
Warning: Data may be inaccurate compared to the source.Recreation
Highlights
This is the first time I've done a dumbbell plot with D3. When I was learning D3, a few months ago, I thought there must be a part of the code where you identify what you are going to create, something like “type=dumbbell”. I quickly realized that it's all about lines, circles, and rectangles.
- I liked the result. It's funny how I'm more able to come up with solutions, whether it's the best way or whether I've done the same thing as the source, I've come up with a way to do it and visually it's very similar. I think the most important thing is to think creatively.
- Whenever I can I try to test alternative ways of inserting text, to keep finding solutions and learning. I'm still getting used to the fact that SVG text is very different from HTML text in terms of the use of attributes.
- In the previous recreations, I have tried to make each one look good on any device, to make it as responsive as possible. What did not happen with this recreation. I usually have a few hours to recreate the visualizations among other priorities I have, and when I don't have time or I have a very complicated week, I let these little details happen.