Six Ways You Can Make Beautiful Graphs (Like Your Favorite Journalists)
[This article was first published on Plotly Blog, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
This post shows how to make graphs like The Economist, New York Times, Vox, 538, Pew, and Quartz. And you can share–embed your beautiful, interactive graphs in apps, blog posts, and web sites. Read on to learn how. If you like interactive graphs and need to securely collaborate with your team, contact us about Plotly Enterprise.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Graphing Political Opinion In The New Nork Times
The Upshot, a New York Times blog, publishes articles and data visualizations about politics, policy, economics, and everyday life. The visualization below comes from a study of political opinions. Events that occur between the ages of 14-24 are most impactful for the voting patterns and political preferences of the next generations of voters.
We’ve used Plotly’s fill to option to show the confidence intervals. Hover your mouse to see data; click and drag to zoom. Click the source link to see the NYT original piece (you can add links to Plotly graphs).
When To Show Up At A Party In 538
538 is a news site started by statistician Nate Silver. Their staff studied when people show up at parties. They concluded that “The median arrival time of the 803 guests was a whopping 58 minutes after the party’s designated start time.” We used a line of best fit and subplots.
What People Think Of The News In Pew
Pew Research publishes polls about issues, attitudes, and trends. The heatmap below comes from a study by Pew concluding that among liberals and conservatives, “[t]here is little overlap in the news sources they turn to and trust.”
The Illegal Trade In Animal Products In The Economist
The Economist publishes news and analysis on politics, business, finance, science, technology and the connections between them. This plot shows the price per kg of illegal animal products, with a logarithmic x axis.
The History Of Cigarettes In Vox
Vox is a general interest news site, with the goal to explain the news. This plot was published in an academic journal then used in a Vox article on tobacco. Vox points out that after 1890, “Cigarettes only went from niche product to mass-market success after the rolling machine improved dramatically.”
The Economics Of Unemployment In Quartz
Quartz is a news outlet for the new global economy. This plot comes from a piece concluding that “America has an unemployment problem, but specifically, it has a long-term unemployment problem.” We’ve styled the notes to be the same color as and reside beside the lines they identify.
How We Made These Plots & How You Can Too
The most difficult part about making these charts is accessing the data. We often use WebPlotDigitzer to access the data in graphs. Then we embed plots in our blog. To match Plotly’s colors with the original graphic, there are a number of tools available to you, including:
- WPD’s own color picker under → Auto → or →
- The DigitalColorMeter program that comes standard with all Mac computers
- Downloadable programs such as Instant Eyedropper (Windows), Art Director’s Toolkit (Mac), xScope (Mac), or the Chrome colorZilla extension
If you’ve made a style you like, you can save and apply that style as a theme. Or, you can save themes from the plots in this post (or any plots from the Plotly feed).
If you’re a developer, you can specify your colors, fonts, data, or styles with our APIs. Python users can embed in IPython Notebooks with matplotlib; R users in RPubs and Shiny with ggplot2; MATLAB users can share MATALB figures. Every plot is accessible as a static image or as code in Python, R, MATLAB, Julia, JavaScript, or JSON. For example, for the last plot, see:
- https://plot.ly/~Quartz/8.embed
- https://plot.ly/~Quartz/8.svg
- https://plot.ly/~Quartz/8.png
- https://plot.ly/~Quartz/8.pdf
- https://plot.ly/~Quartz/8.eps
- https://plot.ly/~Quartz/8.r
- https://plot.ly/~Quartz/8.py
- https://plot.ly/~Quartz/8.m
- https://plot.ly/~Quartz/8.jl
- https://plot.ly/~Quartz/8.json
To leave a comment for the author, please follow the link and comment on their blog: Plotly Blog.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.