Six Ways You Can Make Beautiful Graphs (Like Your Favorite Journalists)

April 8, 2015
By

(This article was first published on Plotly Blog, and kindly contributed to R-bloggers)

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.


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.

The Formative Years
Ages 14-24 are of paramount importance for forming
long-term presidential voting preferences." style="display: block; text-align: center;">The Formative Years
Ages 14-24 are of paramount importance for forming
long-term presidential voting preferences." style="max-width: 100%;width: 800px;" width="450" onerror="this.onerror=null;this.src='https://plot.ly/404.png';"/>

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.

How to Estimate When People Will Arrive at a Party" style="display: block; text-align: center;">How to Estimate When People Will Arrive at a Party" style="max-width: 100%;width: 675px;" width="450" onerror="this.onerror=null;this.src='https://plot.ly/404.png';"/>

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.”

Trust Levels of News Sources by Ideological Group

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.

Too high a price: The illegal trade in animal products" style="display: block; text-align: center;">Too high a price: The illegal trade in animal products" style="max-width: 100%;width: 900px;" width="450" onerror="this.onerror=null;this.src='https://plot.ly/404.png';"/>

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.”

Per Capita Consumption of Tobacco in the United States, 1880-1995" style="display: block; text-align: center;">Per Capita Consumption of Tobacco in the United States, 1880-1995" style="max-width: 100%;width: 900px;" width="450" onerror="this.onerror=null;this.src='https://plot.ly/404.png';"/>

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.

Indexed Unemployment Levels Since the Recession Began" style="display: block; text-align: center;">Indexed Unemployment Levels Since the Recession Began" style="max-width: 100%;width: 775px;" width="450" onerror="this.onerror=null;this.src='https://plot.ly/404.png';"/>

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:

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:

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 on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers


Sponsors

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)