Skip to content

Commit 5772c17

Browse files
committed
Update spei.R
Correct bug that prevented the SPEI plot to have different fill colors for positive and negative values in some systems.
1 parent 2c28170 commit 5772c17

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

R/spei.R

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -969,8 +969,8 @@ plot.spei <- function(x, ...) {
969969

970970
# Plot it
971971
g <- ggplot(kk, aes(.data[["time"]], .data[["value"]],
972-
fill = "cat",
973-
color = "cat"
972+
fill = .data[["cat"]],
973+
color = .data[["cat"]]
974974
))
975975
# reference period (if different than whole series)
976976
if (!is.null(x$ref.period)) {
@@ -981,10 +981,10 @@ plot.spei <- function(x, ...) {
981981
# add the bars with the SPEI values
982982
g <- g +
983983
geom_bar(stat = "identity") + # color='white' helps separate between values
984-
# scale_fill_manual(values=c('blue','red')) + # classic SPEI look
985-
# scale_color_manual(values=c('blue','red')) + # classic SPEI look
986-
scale_fill_manual(values = c("cyan3", "tomato")) + # new look
987-
scale_color_manual(values = c("cyan3", "tomato")) # new look
984+
#scale_fill_manual(values=c('blue','red')) + # classic SPEI look
985+
#scale_color_manual(values=c('blue','red')) # classic SPEI look
986+
scale_fill_manual(values = c("cyan3", "tomato")) + # new look
987+
scale_color_manual(values = c("cyan3", "tomato")) # new look
988988
# add NAs
989989
g <- g +
990990
geom_point(aes(.data[["time"]], .data[["na"]]),

0 commit comments

Comments
 (0)