zmeers / ggparliament

Simple parliament plots using ggplot2
https://zmeers.github.io/ggparliament/
Other
150 stars 13 forks source link

geoms versus monolithic ggplot objects #7

Closed zmeers closed 6 years ago

zmeers commented 6 years ago

I think we should consider breaking down ggparliament() into separate geoms. This will give the user more flexibility over the final product and it should more like an extension to ggplot2 instead of a separate plotting system. Moreover, breaking the monolithic functions into separate geoms gives us the opportunity to create additional functions for data preparation and scales for party colours.
The user will have the ability to pick and choose separate parts of the package AND they won't have to learn entirely new parameters as the ggplot2 syntax should be relatively familiar to them already. I'm proposing that we do the following (they are just examples and I'm open to change!):

RobWHickman commented 6 years ago

yeah completely agree. It should also allow stuff like gganimation/tweenr stuff to be integrated easier 👍

zmeers commented 6 years ago

I think we'll have to write our code using tidyeval (https://dplyr.tidyverse.org/articles/programming.html, http://ggplot2.tidyverse.org/articles/extending-ggplot2.html#creating-a-new-geom). I've never used tidyeval before... So we'll see how it goes.

RobWHickman commented 6 years ago

one thing that I'm not sure is needed or even desirable, but in terms of using geoms, might be interesting if there are any parliaments that have (e.g.) one chamber of arcs vs. one chamber of benches.

Could be interesting to try and get that working using facets a la https://stackoverflow.com/questions/7903972/can-you-specify-different-geoms-for-different-facets-in-a-ggplot

zmeers commented 6 years ago

Regarding creating new types of faceting, read https://cran.r-project.org/web/packages/ggplot2/vignettes/extending-ggplot2.html

zmeers commented 6 years ago

I'd like to get the opposition benches working in the new geom before we merge with the master branch. And I think when we merge, we should update the version of the package.