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

Plots #10

Closed
thibautjombart opened this issue Jul 3, 2020 · 1 comment
Closed

Plots #10

thibautjombart opened this issue Jul 3, 2020 · 1 comment

Comments

@thibautjombart
Copy link
Contributor

plot vs facet_plot

The current design with plot only working with 0-1 group makes sense, and pool is nice enough to use. However I wonder if users would like this to be wrapped automatically through plot. Maybe this is something we should ask in community feedback? I think my personnal preference is the current implementation.

More plotting options

I would like to add some more plotting options beyond the geom_col, which is effectively a histogram. It would be nice to add a geom_point and a geom_line, e.g.

## only points
dat %>% 
  incidence(date_of_onset) %>%
  plot(type = "point")

## points and lines
dat %>% 
  incidence(date_of_onset) %>%
  plot(type = c("point", "line")

In terms of x-axis positioning, these would be set at the middle of the corresponding time interval.

Little helpers

It would be nice to offer some small helpers which will be frequently used. Again, community feedback will be useful there. I can think of, for instance:

  • a small helper for rotating the labels on the x-axis, as this is often needed to avoid overlapping labels
  • a small helper for changing the date formats on the x-axis

Default styling

This is a big selling point, and I like the idea that the new version will look, well, new.

  • background: not a fan of the ggplot2 default grey; may be try defaulting to theme_bw()?
  • default color palette: the one I had made for incidence is quite sad looking; I had used paletton to pick colors that were quite distinct but even then I am not sure the result works well; it would be nice to have a better, more vivid, colorblind-friendly default
  • default color: could become the first color of the default color palette?
  • other palettes: do we want to provide out-of-the-box support for other color palettes, e.g. those defined in ggplot2 and RColorBrewer (probably sticking to categorical variables)?
@TimTaylor
Copy link
Collaborator

One option is to have a plot method and two plot functions single_plot and facet_plot. My inclination would be for the plot method to default to plot_facet when groups are present (using a default argument such as single = FALSE). The user would then have the following options:

  • x %>% plot() equivalent to x %>% facet_plot()
  • x %>% plot(single = TRUE) equivalent to x %>% single_plot()

We can keep single_plot and facet_plot as user facing to give them the choice. I'll implement this in a separate branch to see how it feels.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants