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

geom_zebra_bands() #15

Open
aphalo opened this issue Dec 1, 2022 · 4 comments
Open

geom_zebra_bands() #15

aphalo opened this issue Dec 1, 2022 · 4 comments
Assignees
Labels
enhancement New feature or request on hold To be reconsidered at a later time

Comments

@aphalo
Copy link
Owner

aphalo commented Dec 1, 2022

A geom to highlight boundaries, such as day and night or times with abnormal data, etc. It would be similar to geom_col() but not anchored on zero. It would use aesthetics ymin and ymax, with -Inf and Inf supported for edge to edge bands. geom_col() does not support -Inf mapped to y, and is based at zero. geom_area() seems to fail with POSIXct mapped to x. Ideally alpha should affect both fill and colour.

The example below was produced with two geom_col() layers.

  geom_col(aes(x = time,
               y = Inf,
               fill = day_or_night),
           alpha = 0.1) +
  geom_col(aes(x = time,
               y = -5,
               fill = day_or_night),
           alpha = 0.1) +
  scale_fill_manual(name = "",
                    values = c(day = "yellow", night = "grey50"),
                    aesthetics = c("colour", "fill")) +

Rplot

@aphalo aphalo added the enhancement New feature or request label Dec 1, 2022
@aphalo aphalo added this to the Future version milestone Dec 1, 2022
@aphalo aphalo self-assigned this Dec 1, 2022
@aphalo aphalo changed the title geom_zebra_band() geom_zebra_bands() Dec 1, 2022
@aphalo
Copy link
Owner Author

aphalo commented Dec 4, 2022

Well, one can use geom_area() for this, easily if the time step in consistent. A statistics to compute the values for/night trnasitions could be useful, though.

@aphalo aphalo added the on hold To be reconsidered at a later time label Dec 4, 2022
@aphalo aphalo closed this as completed Dec 4, 2022
@aphalo aphalo reopened this Dec 4, 2022
@aphalo aphalo modified the milestones: Future version, v0.5.2 Feb 4, 2023
@aphalo
Copy link
Owner Author

aphalo commented Feb 20, 2023

I think one could build this geom as a wrapper on geom_rect() allowing arbitrary widths for the alternating zebra bands. One would need some way of setting the two colours and the leftmost colour for alternations. Something like two variables one for x.dawn and x.dusk.

@aphalo aphalo modified the milestones: v0.5.2, Future version May 13, 2023
@aphalo
Copy link
Owner Author

aphalo commented May 13, 2023

A more general name for the variables such as switch.on and switch.off would be better than dawn and dusk, as the geom could be used for any cyclic or alternating states.

@aphalo aphalo modified the milestones: Future version, v0.5.3 May 13, 2023
@aphalo aphalo modified the milestones: v0.5.3, v0.5.4 Jul 8, 2023
@aphalo
Copy link
Owner Author

aphalo commented Jul 8, 2023

Moved to next milestone. I need to still ponder on the best UI and how to implement it.

@aphalo aphalo modified the milestones: v0.5.4, Future version Aug 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request on hold To be reconsidered at a later time
Projects
None yet
Development

No branches or pull requests

1 participant