Skip to content

Commit

Permalink
update coloration in plot_defol()
Browse files Browse the repository at this point in the history
  • Loading branch information
chguiterman committed May 20, 2020
1 parent d255ffe commit 1dd55f4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion NAMESPACE
Expand Up @@ -40,7 +40,7 @@ importFrom(ggplot2,geom_ribbon)
importFrom(ggplot2,geom_segment)
importFrom(ggplot2,geom_vline)
importFrom(ggplot2,ggplot)
importFrom(ggplot2,scale_colour_brewer)
importFrom(ggplot2,scale_colour_manual)
importFrom(ggplot2,scale_x_continuous)
importFrom(ggplot2,scale_y_continuous)
importFrom(ggplot2,theme)
Expand Down
9 changes: 6 additions & 3 deletions R/plotting.R
Expand Up @@ -8,6 +8,7 @@
#'
#' @importFrom rlang .data :=
#' @importFrom ggplot2 ggplot aes geom_segment theme_bw theme element_blank
#' scale_colour_manual
#'
#' @examples
#' data("dmj_defol")
Expand All @@ -34,22 +35,24 @@ plot_defol <- function(x, breaks) {
labels = c("Severe",
"Moderate",
"Minor"))
# plot object formation
p <- ggplot(x, aes(x = .data$year, y = .data$series))
p <- p + geom_segment(data = s_stats,
aes(x = .data$first,
xend = .data$last,
y = .data$series,
yend = .data$series),
linetype = "dotted")
p <- p + geom_segment(data = e_stats,
p <- p +
geom_segment(data = e_stats,
aes(x = .data$start_year,
xend = .data$end_year,
y = .data$series,
yend = .data$series,
colour = .data$Severity),
linetype = "solid",
size = 1.25)
size = 1.25) +
# custom colors, provided by ggsci::pal_npg()
scale_colour_manual(values = c( "#DC0000FF", "#F39B7FFF", "#4DBBD5FF"))
p <- p + theme_bw() +
theme(
panel.grid.major.y = element_blank(),
Expand Down

0 comments on commit 1dd55f4

Please sign in to comment.