-
Notifications
You must be signed in to change notification settings - Fork 2k
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
scale_x_date passes NAs to the label function #2182
Comments
Could you please provide a minimal reproducible example using the reprex package? I'm having trouble reproducing the example from that SO link. |
This fails with an error message.; howver, if we uncomment the line containing
The output of the
|
The root cause is that the breaks algorithm generates breaks that are outside of the limits, and these get converted to NAs. It would be possible to fix this problem but it would require modifying code that I no longer understand and is probably not terribly well tested. Given that there's an existing work around (make sure your labelling function can handle NAs), unfortunately I don't think it's worthwhile to try and fix this bug. |
When using
scale_x_date(..., label = fun)
it can be that NAs are passed tofun
which adds undesirable complexity to the definition of the function.See this example:
https://stackoverflow.com/questions/44616530/prevent-showing-the-year-several-times-unnecessarily-with-time-series/44751923#44751923
where this line had to be added to avoid errors even though the NAs do not actually correspond to breaks:
Any date could have been used in place of
Sys.Date()
since it seems that the date itself is not actually used if the passed break is NA.The text was updated successfully, but these errors were encountered: