-
Notifications
You must be signed in to change notification settings - Fork 4
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
Plot edits #25
Plot edits #25
Conversation
R/gwlAreaPlot.R
Outdated
|
||
vals <- vals[2] | ||
labs <- labs[2] | ||
override_list <- lapply(override_list, `[`, 2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clever!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tx! copy-paste-try-bonk-figureoutwhatcodedoes-tweak-worked....
R/gwlAreaPlot.R
Outdated
} else { | ||
vals <- vals[1] | ||
labs <- labs[1] | ||
override_list <- lapply(override_list, `[`, 1) | ||
} | ||
|
||
if (show_stable_line) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great. I think it could be simplified by lumping the logic a bit - does this make sense?
if (show_stable_line || tolower(trend_category) != "stable" {
plot.area <- plot.area +
geom_abline(aes_string(intercept = "intercept", slope = "slope", colour = "'LTT'"),
data = data.frame(intercept = -int.well, slope = slope), size = 1)
} else if (tolower(trend_category) == "stable") {
vals <- vals[2]
labs <- labs[2]
override_list <- lapply(override_list, `[`, 2)
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I was sure there was a more efficient path than an embedded if/else
. I had not seen the ||
or the if/else if
. Cool.
Co-authored-by: Andy Teucher <andy.teucher@gov.bc.ca>
show_stable_line
argument togwl_area_plot
with default not to plot trend line if result is stabletrend
totrend_category
gwl_area_plot
(Trend: to Category: with slope only when category not stable, no P-value)@ateucher Not sure that an if/else inside an if/else is kosher?