1919# ' @param gp An object of class \code{"gpar"}, this is the graphical parameter
2020# ' settings of the text. See \code{\link[grid]{gpar}}.
2121# ' @param padding Padding of the text, default is \code{unit(1, "mm")}
22- # ' @param parse Logical, behaviour for parsing text as plotmath, see
23- # ' \code{\link[grDevices]{plotmath}}
22+ # ' @param parse Logical, behaviour for parsing text as plotmath, see
23+ # ' \code{\link[grDevices]{plotmath}}
2424# '
2525# ' @return A \code{\link[gtable]{gtable}} object.
26- # ' @seealso \code{\link[gtable]{gtable}} \code{\link[grid]{gpar}} \code{\link[grid]{textGrob}}
27- # ' \code{\link[gtable]{gtable_add_grob}}
26+ # ' @seealso \code{\link[gtable]{gtable}} \code{\link[grid]{gpar}} \code{\link[grid]{textGrob}}
27+ # ' \code{\link[gtable]{gtable_add_grob}}
2828# ' @export
2929# '
3030add_text <- function (plot ,
@@ -36,7 +36,7 @@ add_text <- function(plot,
3636 gp = gpar(),
3737 padding = unit(1 , " mm" ),
3838 parse = FALSE ){
39-
39+
4040 if (parse )
4141 text <- tryCatch(parse(text = text ), error = function (e ) text )
4242
@@ -76,7 +76,7 @@ add_text <- function(plot,
7676
7777 # Span to whole plot if col is missing
7878 if (is.null(col ))
79- col <- 2 : max(l $ r )
79+ col <- min( l $ l ) : max(l $ r )
8080 else
8181 col <- 1 + col # Add 1 to account for padding of the plot
8282
0 commit comments