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 experimental ggplot2 scales for calendars #345

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,16 @@ Imports:
vctrs (>= 0.6.1)
Suggests:
covr,
ggplot2 (>= 3.4.2.9000),
knitr,
magrittr,
pillar,
rmarkdown,
scales (>= 1.2.1),
slider (>= 0.3.0),
testthat (>= 3.0.0),
withr
withr,
vdiffr (>= 1.0.5)
LinkingTo:
cpp11 (>= 0.4.3),
tzdb (>= 0.3.0.9000)
Expand All @@ -48,4 +51,5 @@ LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
Remotes:
r-lib/tzdb
r-lib/tzdb,
tidyverse/ggplot2#5304
21 changes: 21 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,27 @@ export(is_zoned_time)
export(iso_year_week_day)
export(naive_time_info)
export(naive_time_parse)
export(scale_alpha_year_month_day)
export(scale_alpha_year_quarter_day)
export(scale_alpha_year_week_day)
export(scale_color_year_month_day)
export(scale_color_year_quarter_day)
export(scale_color_year_week_day)
export(scale_colour_year_month_day)
export(scale_colour_year_quarter_day)
export(scale_colour_year_week_day)
export(scale_fill_year_month_day)
export(scale_fill_year_quarter_day)
export(scale_fill_year_week_day)
export(scale_size_year_month_day)
export(scale_size_year_quarter_day)
export(scale_size_year_week_day)
export(scale_x_year_month_day)
export(scale_x_year_quarter_day)
export(scale_x_year_week_day)
export(scale_y_year_month_day)
export(scale_y_year_quarter_day)
export(scale_y_year_week_day)
export(set_day)
export(set_hour)
export(set_index)
Expand Down
18 changes: 18 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# clock (development version)

* New experimental ggplot2 scales for calendar types, including (#233):

* `scale_*_year_month_day()`, which supports year and month precision
year-month-day vectors.

* `scale_*_year_quarter_day()`, which supports year and quarter precision
year-quarter-day vectors.

* `scale_*_year_week_day()`, which supports year and week precision
year-week-day vectors.

Note that these scales are limited in the precisions they support. This is
purposeful, and for the most part the scales are limited to the precisions
that you can perform arithmetic with (i.e. you can't add days to
year-month-day, so the scale doesn't support day precision). For precisions at
or more precise than day, the native ggplot2 scales for Date and POSIXct are
still a better option.

* New `date_spanning_seq()` for generating a regular sequence along the full
span of a date or date-time vector (i.e. along `[min(x), max(x)]`). It is
similar to `tidyr::full_seq()`, but is a bit simpler and currently has better
Expand Down
3 changes: 3 additions & 0 deletions R/clock-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@
#' @useDynLib clock, .registration = TRUE
## usethis namespace: end
NULL

# Singleton environment
the <- new_environment()
Loading