Skip to content

Commit

Permalink
fixes #728
Browse files Browse the repository at this point in the history
in conjunction with sf >= 1.0-20
  • Loading branch information
edzer committed Jan 10, 2025
1 parent 76df605 commit 6f7b884
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,11 @@ plot.stars = function(x, y, ..., join_zlim = TRUE, main = make_label(x, 1), axes
get_breaks(x, breaks, nbreaks, dots$logz)
if (!inherits(breaks, c("POSIXt", "Date")))
breaks = as.numeric(breaks)
if (length(breaks) > 2)
# https://github.com/r-spatial/stars/issues/728:
if (packageVersion("sf") < "1.0.20")
breaks = unique(breaks)
nbreaks = length(breaks) # might be shorter than originally intended!
if (breaks.missing && nbreaks <= 2) # unlucky default!
if (breaks.missing && length(unique(breaks)) <= 2) # unlucky default!
warning('breaks="quantile" leads to a single class; maybe try breaks="equal" instead?')
}

Expand Down

0 comments on commit 6f7b884

Please sign in to comment.