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

Diverging Lollipop Chart #93

Closed
spsanderson opened this issue Aug 19, 2021 · 0 comments
Closed

Diverging Lollipop Chart #93

spsanderson opened this issue Aug 19, 2021 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@spsanderson
Copy link
Owner

Diverging Lollipop Chart
Lollipop chart conveys the same information as bar chart and diverging bar. Except that it looks more modern. Instead of geom_bar, I use geom_point and geom_segment to get the lollipops right. Let’s draw a lollipop using the same data I prepared in the previous example of diverging bars.

The parameters should be

  1. .plot_title
  2. .plot_subtitle
  3. .plot_caption
  4. .x_axis_title
  5. .y_axis_title
  6. ggplot aes() x, y, label
  7. geom_segment x/xend, y_end should equal label
library(ggplot2)
theme_set(theme_bw())

ggplot(mtcars, aes(x=`car name`, y=mpg_z, label=mpg_z)) + 
  geom_point(stat='identity', fill="black", size=6)  +
  geom_segment(aes(y = 0, 
                   x = `car name`, 
                   yend = mpg_z, 
                   xend = `car name`), 
               color = "black") +
  geom_text(color="white", size=2) +
  labs(title="Diverging Lollipop Chart", 
       subtitle="Normalized mileage from 'mtcars': Lollipop") + 
  ylim(-2.5, 2.5) +
  coord_flip()

ggplot_masterlist_11

@spsanderson spsanderson added the enhancement New feature or request label Aug 19, 2021
@spsanderson spsanderson added this to the healthyR 0.1.6 milestone Aug 19, 2021
@spsanderson spsanderson added this to To Do in healthyR Project Board via automation Aug 19, 2021
@spsanderson spsanderson self-assigned this Aug 19, 2021
healthyR Project Board automation moved this from To Do to Done Aug 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

1 participant