Defining ggplot scales for custom S3 classes

ggplot2
scales

#1

Does anyone know where I can find documentation on creating custom ggplot2 scales for S3 classes? I am working on a package that contains a class for year-quarter/month/week dates and I'd like them to show up nicely by default.

I found an old gist that does something similar for the zoo package, but that one is 6 years old and contains some guessing judging from the comments. I was wondering if there is some official documentation somewhere.


#2

There is a great vignette on how to extend ggplot2
https://ggplot2.tidyverse.org/articles/extending-ggplot2.html
I don't know if it covers all you are looking for but it could be a start if you don't know about it.


#3

I've seen that, there are some small code examples on scales, but i was hoping for something more detailed


#4

It's possible you've already seen this, too, but there is a section in the scales function reference on Creating your own scales and mutable ranges.


#5

Hmm thanks that also seems helpfull.. ill see if i can manage to hack something together :slight_smile: