Skip to content
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

Merged
merged 8 commits into from
Jun 28, 2018
Merged

Plot edits #25

merged 8 commits into from
Jun 28, 2018

Conversation

stephhazlitt
Copy link
Member

@stephhazlitt stephhazlitt commented Jun 26, 2018

  • add show_stable_line argument to gwl_area_plot with default not to plot trend line if result is stable
  • rename argument from trend to trend_category
  • change subtitle text for gwl_area_plot (Trend: to Category: with slope only when category not stable, no P-value)
  • lighter and smaller interpolated points
  • update vignette

@ateucher Not sure that an if/else inside an if/else is kosher?

R/gwlAreaPlot.R Outdated

vals <- vals[2]
labs <- labs[2]
override_list <- lapply(override_list, `[`, 2)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clever!

Copy link
Member Author

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) {
Copy link
Contributor

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)
}

Copy link
Member Author

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.

stephhazlitt and others added 2 commits June 26, 2018 15:53
Co-authored-by: Andy Teucher <andy.teucher@gov.bc.ca>
@stephhazlitt stephhazlitt merged commit 2f427b6 into master Jun 28, 2018
@stephhazlitt stephhazlitt deleted the plot-edits branch June 28, 2018 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants