Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add geom_love() #5

Merged
merged 8 commits into from
Aug 11, 2022
Merged

Add geom_love() #5

merged 8 commits into from
Aug 11, 2022

Conversation

malcolmbarrett
Copy link
Collaborator

@malcolmbarrett malcolmbarrett commented Aug 5, 2022

This PR adds a simple geom for creating Love plots. I did kind of a weird thing where I included the aes() in geom_love() so you can just pass the dataframe to ggplot() without all the mapping. It's somewhere between a wrapper function and a pure geom, so I don't know how I feel about that part.

Closes #2

@LucyMcGowan, what do you think about this?

library(tidysmd)
library(ggplot2)
plot_df <- tidy_smd(
  nhefs_weights,
  race:active,
  .group = qsmk,
  .wts = starts_with("w_")
)

ggplot(plot_df) + geom_love()

Created on 2022-08-05 by the reprex package (v2.0.1)

R/geom_love.R Outdated Show resolved Hide resolved
@malcolmbarrett
Copy link
Collaborator Author

I think maybe I should write a pure geom for those who want it and wrap it in love_plot() for ease of typing

@LucyMcGowan
Copy link

This looks awesome 😍

@malcolmbarrett malcolmbarrett merged commit 4f8287e into main Aug 11, 2022
@malcolmbarrett malcolmbarrett deleted the geom_love branch August 11, 2022 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

geom_smd() wrapper?
2 participants