Skip to content

Instantly share code, notes, and snippets.

@MCMaurer
Created February 20, 2018 22:51
Show Gist options
  • Save MCMaurer/756befacf1963e4172f95bc65ec1df2b to your computer and use it in GitHub Desktop.
Save MCMaurer/756befacf1963e4172f95bc65ec1df2b to your computer and use it in GitHub Desktop.
Creating a Tufte-style range-frame scatterplot using ggplot
library(ggplot2)
library(ggthemes)
ggplot(mtcars, aes(wt,mpg))+
geom_point()+
theme_tufte()+
theme(axis.ticks = element_blank())+
xlab("Car weight (lb/1000)")+
ylab("Miles per gallon of fuel")+
scale_x_continuous(breaks = round(as.vector(quantile(mtcars$wt)), digits = 1))+
scale_y_continuous(breaks = round(as.vector(quantile(mtcars$mpg)), digits = 1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment