These comparisons offer a glimpse into baseball’s biggest and most shameful question: What if the game had not been segregated for nearly half of the 20th century, and these players were able to play alongside the rest of the greats? https://t.co/FnXpsLdKuu
Impressed by the graphs on popular site FiveThirtyEight? This quick tutorial gets you started making your own eye-catching visualizations.
When you have it all visualized, it really jumps at you. — Giorgia Lupi Update: Check out the postcards you mailed us here! For 52 weeks, Giorgia Lupi and Stef…
The fivethirtyeight R package – released by Albert Y. Kim, Chester Ismay, and Jennifer Chunn last March – contains dozens of datasets used in FiveThirtyEight news articles like "A Handful Of Cities Are Driving 2016’s Rise In Murders," "The Best MLB All-Star Teams Ever," and "The Dallas Shooting Was Among The Deadliest For Police In U.S. History." This tutorial
William Koch — yes, one of those Kochs — is giving a tour of his wine cellar when he asks the obvious question: “Did you see the wine bathroom?” he asked. “Wa…
In football, there are constant power struggles, both on and off the field: players battling players, offenses battling defenses, the passing game battling the …
I absolutely love this visualisation by FiveThirtyEight . It’s clean, uses minimal color, and is overall nice to look at. So naturally I wan...
Another year, another few hundred charts and maps on FiveThirtyEight. (Not to mention our interactive graphics and updating dashboards.) To celebrate the end of…
FiveThirtyEight created a chart that explores how many of each Star Wars lightsaber color there are, both canon and the expanded universe stories. Their
Infographics aren’t new. And certainly, interactive ones aren’t either—but with the launch of recent data-driven news sites such as Vox, Fivethirtyeight and
In addition to a number of interactive graphics and updating dashboards, this year we published almost 1,000 charts and maps on FiveThirtyEight. Here are 52 of …
UPDATE (Oct. 4, 10:43 a.m.): You’re reading a vintage FiveThirtyEight story. Since this article was first published in May, the world’s oldest living person has…
We made more than 1,500 charts in 2015 at FiveThirtyEight. Many were bar charts, line charts and scatterplots — but not all. Here are some of the more unusual …
We’ve made over 2,000 charts since FiveThirtyEight launched in March. With the new year upon us, here are some of our favorites, with an eye toward forms outsid…
Two maps published by the stats wizards at Fivethirtyeight depict likely electoral maps if only men or women voted. Women prefer Hillary Clinton; men prefer Donald Trump. In both cases,…
who picks the oscar winners? I've throughly enyojed designing the collages in this video! It was a fun experience to collaborate with FiveThirtyEight from NYC, such a cheerful team of journalists and animators whom have done their best to give you a bri…
Book jacket designers Jason Booher and Helen Yentus needed “something vaguely digital” for the book debut of Nate Silver – author of The New York Times’ FiveThirtyEight blog. They opted for Plau, a sans-serif that has round corners and deliberately digital inspired shapes
According to FiveThirtyEight and their WSPI formula, the USA is the odds-on favorite to win the FIFA Women's World Cup Canada 2015. In the Round of 16, it appears that the Norway vs England fixture should be a closely fought match as the odds are 50/50.
When it comes to data visualization, flashy graphs can be fun. But if you're trying to convey information, especially to a broad audience, flashy isn't always the way to go. Last week I showed how to work with line graphs in R. In this article, I'm going to talk about creating a scatter plot in R. Specifically, we'll be creating a ggplot scatter plot using ggplot's geom_point function. A scatter plot is a two-dimensional data visualization that uses points to graph the values of two different variables - one along the x-axis and the other along the y-axis. Scatter plots are often used when you want to assess the relationship (or lack of relationship) between the two variables being plotted. Scatter Plot of Adam Sandler Movies from FiveThirtyEight For example, in this graph, FiveThirtyEight uses Rotten Tomatoes ratings and Box Office gross for a series of Adam Sandler movies to create this scatter plot. They've additionally grouped the movies into 3 categories, highlighted in different colors. The Famous Gapminder Scatter Plot of Life Expectancy vs. Income by Country This scatter plot, initially created by Hans Rosling, is famous among data visualization practitioners. It graphs the life expectancy vs. income for countries around the world. It also uses the size of the points to map country population and the color of the points to map continents, adding 2 additional variables to the traditional scatter plot. Hans Rosling used a famously provocative and animated presentation style to make this data come alive. He used his presentations to advocate for sustainable global development through the Gapminder Foundation. Hans Rosling's example shows how simple graphic styles can be powerful tools for communication and change when used properly! Convinced? Let's dive into this guide to creating a ggplot scatter plot in R! Follow Along With the Workbook I've created a free workbook to help you apply what you're learning as you read. The workbook is an R file that contains all the code shown in this post as well as additional questions and exercises to help you understand the topic even deeper. If you want to really learn how to create a scatter plot in R so that you'll still remember weeks or even months from now, you need to practice. So Download the workbook now and practice as you read this post! Introduction to ggplot Before we get into the ggplot code to create a scatter plot in R, I want to briefly touch on ggplot and why I think it's the best choice for plotting graphs in R. ggplot is a package for creating graphs in R, but it's also a method of thinking about and decomposing complex graphs into logical subunits. ggplot takes each component of a graph--axes, scales, colors, objects, etc--and allows you to build graphs up sequentially one component at a time. You can then modify each of those components in a way that's both flexible and user-friendly. When components are unspecified, ggplot uses sensible defaults. This makes ggplot a powerful and flexible tool for creating all kinds of graphs in R. It's the tool I use to create nearly every graph I make these days, and I think you should use it too! Investigating our dataset Throughout this post, we'll be using the mtcars dataset that's built into R. This dataset contains details of design and performance for 32 cars. Let's take a look to see what it looks like: The mtcars dataset contains 11 columns: mpg: Miles/(US) gallon cyl: Number of cylinders disp: Displacement (cu.in.) hp: Gross horsepower drat: Rear axle ratio wt: Weight (1000 lbs) qsec: 1/4 mile time vs: Engine (0 = V-shaped, 1 = straight) am: Transmission (0 = automatic, 1 = manual) gear: Number of forward gears carb: Number of carburetors How to create a simple scatter plot in R using geom_point() ggplot uses geoms, or geometric objects, to form the basis of different types of graphs. Previously I talked about geom_line, which is used to produce line graphs. Today I'll be focusing on geom_point, which is used to create scatter plots in R. library(tidyverse) ggplot(mtcars) + geom_point(aes(x = wt, y = mpg)) Here we are starting with the simplest possible ggplot scatter plot we can create using geom_point. Let's review this in more detail: First, I call ggplot, which creates a new ggplot graph. It's essentially a blank canvas on which we'll add our data and graphics. In this case, I passed mtcars to ggplot to indicate that we'll be using the mtcars data for this particular ggplot scatter plot. Next, I added my geom_point call to the base ggplot graph in order to create this scatter plot. In ggplot, you use the + symbol to add new layers to an existing graph. In this second layer, I told ggplot to use wt as the x-axis variable and mpg as the y-axis variable. And that's it, we have our scatter plot! It shows that, on average, as the weight of cars increase, the miles-per-gallon tends to fall. Changing point color in a ggplot scatter plot Expanding on this example, we can now play with colors in our scatter plot. ggplot(mtcars) + geom_point(aes(x = wt, y = mpg), color = 'blue') You'll note that this geom_point call is identical to the one before, except that we've added the modifier color = 'blue' to to end of the line. Experiment a bit with different colors to see how this works on your machine. You can use most color names you can think of, or you can use specific hex colors codes to get more granular. Now, let's try something a little different. Compare the ggplot code below to the code we just executed above. There are 3 differences. See if you can find them and guess what will happen, then scroll down to take a look at the result. If you've read my previous ggplot guides, this bit should look familiar! mtcars$am