@@ -564,16 +564,16 @@ ggplotts.data.frame <- function(object,show.legend, theme,type,
564564
565565 group <- ggplot2 :: enquo(group )
566566
567- g <- ggplot2 :: ggplot(object ,ggplot2 :: aes(x = Date ,y = Values ),show.legend = show.legend , ... ) +
567+ g <- ggplot2 :: ggplot(object ,ggplot2 :: aes(x = Date ,y = Values ),... ) +
568568 ggplot2 :: xlab(xlab ) + ggplot2 :: ylab(ylab )
569569 switch (type ,
570570 line = g + ggplot2 :: geom_line(ggplot2 :: aes(colour = Variables ,linetype = Variables ,group = !! group ),
571- na.rm = TRUE ),
572- bar = g + ggplot2 :: geom_bar(ggplot2 :: aes(fill = Variables ,group = !! group ),stat = " identity" ) +
571+ na.rm = TRUE , show.legend = show.legend ),
572+ bar = g + ggplot2 :: geom_bar(ggplot2 :: aes(fill = Variables ,group = !! group ),stat = " identity" , show.legend = show.legend ) +
573573 ggplot2 :: stat_summary(fun = sum , geom = " line" , colour = " black" ,
574- linewidth = 0.5 , alpha = 1 ,na.rm = TRUE ),
574+ linewidth = 0.5 , alpha = 1 , na.rm = TRUE ),
575575 segment = g + ggplot2 :: geom_segment(ggplot2 :: aes(xend = Date ,colour = Variables ,group = !! group ),
576- yend = 0 )
576+ yend = 0 , show.legend = show.legend )
577577 ) +
578578 ggplot2 :: scale_x_continuous(
579579 limits = lims ,
@@ -604,7 +604,7 @@ ggplotts.ts <- function(object,show.legend, series_names,theme,type,
604604 ... )
605605}
606606
607- geom_path_scatter <- function (object ,i ,lty ) {
607+ geom_path_scatter <- function (object ,i ,lty , show.legend ) {
608608
609609 n <- nrow(object )
610610
@@ -623,7 +623,8 @@ geom_path_scatter <- function(object,i,lty) {
623623 ends = " last" ,
624624 type = " closed" ,
625625 length = ggplot2 :: unit(0.1 ," inches" )),
626- na.rm = TRUE )
626+ na.rm = TRUE ,
627+ show.legend = show.legend )
627628}
628629
629630ggscatter <- function (object ,show.legend , theme , start , end , xlab ,ylab ,
@@ -635,29 +636,29 @@ ggscatter <- function(object,show.legend, theme, start, end, xlab,ylab,
635636
636637 lty <- lty(ncol(object )- 1L )
637638
638- g <- ggplot2 :: ggplot(show.legend = show.legend , ... ) + ggplot2 :: xlab(xlab ) + ggplot2 :: ylab(ylab )
639+ g <- ggplot2 :: ggplot(... ) + ggplot2 :: xlab(xlab ) + ggplot2 :: ylab(ylab )
639640
640641 if (! is.null(attr(object ," abline" ))) {
641642 g <- g + ggplot2 :: geom_abline(intercept = attr(object ," abline" )[" constant" ],
642643 slope = attr(object ," abline" )[" slope" ],
643644 lty = " solid" , colour = " red" , linewidth = 1 )
644645 }
645646
646- g <- g + geom_path_scatter(object [,c(1L ,2L )],1L ,lty [1L ])
647+ g <- g + geom_path_scatter(object [,c(1L ,2L )],1L ,lty [1L ], show.legend = show.legend )
647648
648649 if (ncol(object ) == 3L ) {
649650 is_value_reg <- which(! is.na(object [,2L ]))
650651
651652 if (is_value_reg [1L ] != 1L ) {
652653 object_temp <- object [,c(1L ,3L )]
653654 object_temp [(is_value_reg [1L ] + 1L ): nrow(object ),2L ] <- NA
654- g <- g + geom_path_scatter(object_temp ,2L ,lty [2L ])
655+ g <- g + geom_path_scatter(object_temp ,2L ,lty [2L ], show.legend = show.legend )
655656 }
656657
657658 if (is_value_reg [length(is_value_reg )] != nrow(object )) {
658659 object_temp <- object [,c(1L ,3L )]
659660 object_temp [1L : (is_value_reg [length(is_value_reg )]- 1L ),2L ] <- NA
660- g <- g + geom_path_scatter(object_temp ,3L ,lty [2L ])
661+ g <- g + geom_path_scatter(object_temp ,3L ,lty [2L ], show.legend = show.legend )
661662 }
662663
663664 # These are the parts before and after the coefficients calc window
0 commit comments