Home > Software engineering >  Reversing the y axis on discrete data
Reversing the y axis on discrete data

Time:05-10

I have a chart built with ggridges, as below, for which I would like to reverse the date order:

enter image description here

To do this I've added the c_trans() function, as defined enter image description here which is clearly not what I want. Is there any way to reverse the y axis but keep it discrete?

Input data:

> lengthCounts2
# A tibble: 8,724 x 5
# Groups:   date, rwi [6]
   date                rwi     len       n normalised
   <dttm>              <chr> <dbl>   <int>      <dbl>
 1 2022-04-13 00:00:00 01       35     677  0.0000319
 2 2022-04-13 00:00:00 01       40 3113138  0.147    
 3 2022-04-13 00:00:00 01       41   15078  0.000710 
 4 2022-04-13 00:00:00 01       42    2077  0.0000978
 5 2022-04-13 00:00:00 01       43    2554  0.000120 
 6 2022-04-13 00:00:00 01       44   29190  0.00137  
 7 2022-04-13 00:00:00 01       45    2065  0.0000972
 8 2022-04-13 00:00:00 01       46    2054  0.0000967
 9 2022-04-13 00:00:00 01       47    2625  0.000124 
10 2022-04-13 00:00:00 01       48  146334  0.00689  
# ... with 8,714 more rows

CodePudding user response:

Use:

ylim("20220427", "20220420", "20220413") 
  • Related