Skip to content

Instantly share code, notes, and snippets.

@LuisSevillano
Created September 30, 2019 08:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LuisSevillano/261835d1e1e64b50d1be2c0b6b712e3c to your computer and use it in GitHub Desktop.
Save LuisSevillano/261835d1e1e64b50d1be2c0b6b712e3c to your computer and use it in GitHub Desktop.
Extract data from ggplot plot
plot <- ggplot(data = pf, aes(x = age, y = df)) +
geom_point(alpha = 1/100,
position = position_jitter(h = 0),
color = "darkred")
ggplot(data = layer_data(plot, 1), aes(x = x, y = y)) +
geom_point(alpha = 1/20)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment