Improved default autoplot.mts interaction when setting facets=TRUE #473

Merged
merged 1 commit into from Jan 12, 2017

Projects

None yet

3 participants

@mitchelloharawild
Collaborator

Now when facets=TRUE, colour=FALSE, unless specified directly with autoplot(mts, colour=TRUE, facets=TRUE)

@mitchelloharawild mitchelloharawild Improved default autoplot.mts interaction when setting facets=TRUE
Now when `facets=TRUE`, `colour=FALSE`, unless specified directly with `autoplot(mts, colour=TRUE, facets=TRUE)`
8da9e29
@@ -1247,7 +1247,7 @@ autoplot.mts <- function(object, colour=TRUE, facets=FALSE, ...){
#Initialise ggplot object
mapping <- ggplot2::aes_(y=~y, x=~x, group=~series)
- if(colour){
+ if (colour & (!facets | !missing(colour))){
@robjhyndman
robjhyndman Jan 12, 2017 Owner

Not sure that it makes sense to have colour and !missing(colour) in the one if statement.

@mitchelloharawild
mitchelloharawild Jan 12, 2017 edited Collaborator

That's the logic behind if they've specified the colour argument or not.

Expanding the logic gives:
colour & !missing(colour) (They've specified colour=TRUE as an argument)
colour & !facets (They have specified facets=FALSE (or left it as default))

As a result, only when facets is TRUE, and if colour is unspecified, or when colour=FALSE, the colour isn't added... Perhaps the reverse logic would be simpler.

@coveralls

Coverage Status

Coverage remained the same at 78.922% when pulling 8da9e29 on mitchelloharawild:autoplot.mts into 476cecb on robjhyndman:master.

@robjhyndman robjhyndman merged commit 4a02b84 into robjhyndman:master Jan 12, 2017

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage remained the same at 78.922%
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment