Thanks, @Hermes, that is helpful. I didn't realize you were trying to write the code in python to describe what you intended -- I had thought you were posting actual python code from a package you had mentioned earlier. I might suggest you try pseudocode in R, instead, referring to the documentation specifications you're implementing, in much the way it looks like you tried to develop your python code. That would be helpful, since folks here may not be familiar with python syntax, and may have trouble following you.
I'll come back again when I can, but if you look at the R documentation for scale_x_date() (which I'm sure you did, from your python code), it says breaks should be one of
- NULL for no breaks
- waiver() for the breaks specified by date_breaks
- A Date/POSIXct vector giving positions of breaks
- A function that takes the limits as input and returns breaks as output
so the last two would apply in your case, and it says limits should be one of:
- NULL to use the default scale range
- A numeric vector of length two providing limits of the scale. Use NA to refer to the existing minimum or maximum
- A function that accepts the existing (automatic) limits and returns new limits
where, again, the last two apply in your case.
From this, it looks like limits are stored in any case as a vectors of length two, indicating the min and max, so the function version of breaks should probably takes these as input and return the third type of breaks, namely a "Date/POSIXct vector giving positions of breaks".
I hope this helps, and thanks again for the clarification.