This is a plot of temperature against wind speed using R's weather data (nycflights13 package). The question asks what is the distribution of temperature as a function of windspeed? Honestly, I don't see any distribution.

enter image description here

  • 3
    $\begingroup$ One reason you cannot see a distribution is that this plot isn't able to show it correctly due to the extensive overplotting of points. Use a visualization that enables you to see the actual bivariate distribution the data (jitter the points, use transparency, make hex plots, use sunflowers, etc). $\endgroup$
    – whuber
    Oct 26, 2019 at 14:10

1 Answer 1


First, the data you are using is an hourly time series covering one complete year (2013). So in your plot there is a lot of overplotting, which hides structure. One way of avoiding it is


Code for this plot:

ggplot(weather, aes(x=wind_speed, y=temp)) + geom_hex() + 
       xlim(0, 50) + xlab("wind_speed (mph)") + 
       ylab("temp (F)")

But this is still hiding a lot of variation, we would expect both monthly variation, and hourly variation (and time series correlations we do not go into.)


Faceting first by month, then by hours, separately:

hex-plot, faceted by month

hex-plot, faceted by hour

Then this graphical investigation can continue in this way ... Below is a plot from an earlier version, kept for documentation. Wasn't a very good idea:

One try is to show hourly variation by color and monthly by faceting:

complex plot from first version, not good idea, kept for docu

It is clearly a lot of seasonal variation, while it is not easy from this plot to understand the hourly variation, at least not for me. Maybe there are better ideas. Code for this plot:

mypal <- RColorBrewer::brewer.pal(6, "Greens")
mypal <- c(mypal,  rev(mypal))  

ggplot(weather, aes(x=wind_speed, y=temp,  col=hour)) + 
       geom_jitter() +x lim(0, 50) + 
       facet_wrap(~month) + scale_color_gradientn(colors=mypal) + 
       xlab("wind_speed (mph)") + ylab("temp (F)")
  • 1
    $\begingroup$ I don't understand the value in the last plot of coloring according to hour: that destroys the virtue of the first plot, which is to show relative counts and thereby reveal the bivariate distribution of speed and temperature. To carry out the program you hint at, begin by faceting the original hex plot by month. $\endgroup$
    – whuber
    Oct 27, 2019 at 14:38
  • $\begingroup$ Agreed, wasn't a very good idea. Edited. $\endgroup$ Nov 2, 2019 at 21:26
  • 1
    $\begingroup$ Upvoted for the clarity and excellence of the (edited) answer. $\endgroup$ Nov 2, 2019 at 22:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.