Skip to content

Feature request: scales for ggplot2 #233

Description

@TimTaylor

Is the plan to eventually be implementing scales for the various calendar objects (e.g. year_month_day)? I'm thinking maybe some sort of factor / categorical type scale would be appropriate depending on the precision?

Activity

  1. mattwarkentin commented on Nov 24, 2022

    @mattwarkentin

    I came here to ask the very same thing. It feels like this should work, but it doesn't. Would love for the addition of ggplot-friendly scales.

    library(tidyverse)
    library(clock)
    library(nycflights13)
    
    flights |> 
      select(year, month, day) |> 
      mutate(
        date = date_build(year, month, day),
        date = as_year_month_day(date),
        gp = calendar_group(date, 'day')
      ) |> 
      count(gp) |> 
      ggplot() +
      aes(gp, n) +
      geom_line()
    #> Don't know how to automatically pick scale for object of type clock_year_month_day/clock_calendar/clock_rcrd/vctrs_rcrd/vctrs_vctr. Defaulting to continuous.
    #> Error: Discrete value supplied to continuous scale

    I was actually thinking it should be some sort of continuous type scale.

  2. added this to the 0.7.0 milestone on Apr 27, 2023
  3. removed this from the 0.7.0 milestone on May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurea feature request or enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions