Skip to content

Commit

Permalink
subrect - check first arg for all coords
Browse files Browse the repository at this point in the history
  • Loading branch information
raredd committed Dec 24, 2021
1 parent 0af64db commit ec576e1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions R/plot_extra.R
Original file line number Diff line number Diff line change
Expand Up @@ -1636,6 +1636,13 @@ subrect <- function(xleft, ybottom, xright, ytop, type = c('diagonal', 'square')
type <- match.arg(type)
pos <- match.arg(pos)

if (length(xleft) == 4L) {
ybottom <- xleft[2L]
xright <- xleft[3L]
ytop <- xleft[4L]
xleft <- xleft[1L]
}

if (type == 'diagonal') {
left <- c(xleft, xright, xleft, xleft)
right <- c(xleft, xright, xright, xleft)
Expand Down

0 comments on commit ec576e1

Please sign in to comment.