File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change 1
1
# ggplot2 (development version)
2
2
3
+ * Fix a bug in ` stat_contour_filled() ` where break value differences below a
4
+ certain number of digits would cause the computations to fail (@thomasp85 ,
5
+ #4874 )
6
+
3
7
* ` stage() ` now properly refers to the values without scale transformations for
4
8
the stage of ` after_stat ` . If your code requires the scaled version of the
5
9
values for some reason, you have to apply the same transformation by yourself,
Original file line number Diff line number Diff line change @@ -328,11 +328,17 @@ iso_to_polygon <- function(iso, group = 1) {
328
328
# ' @noRd
329
329
# '
330
330
pretty_isoband_levels <- function (isoband_levels , dig.lab = 3 ) {
331
- interval_low <- gsub(" :.*$" , " " , isoband_levels )
332
- interval_high <- gsub(" ^[^:]*:" , " " , isoband_levels )
331
+ interval_low <- as.numeric( gsub(" :.*$" , " " , isoband_levels ) )
332
+ interval_high <- as.numeric( gsub(" ^[^:]*:" , " " , isoband_levels ) )
333
333
334
- label_low <- format(as.numeric(interval_low ), digits = dig.lab , trim = TRUE )
335
- label_high <- format(as.numeric(interval_high ), digits = dig.lab , trim = TRUE )
334
+ breaks <- unique(c(interval_low , interval_high ))
335
+
336
+ while (anyDuplicated(format(breaks , digits = dig.lab , trim = TRUE ))) {
337
+ dig.lab <- dig.lab + 1
338
+ }
339
+
340
+ label_low <- format(interval_low , digits = dig.lab , trim = TRUE )
341
+ label_high <- format(interval_high , digits = dig.lab , trim = TRUE )
336
342
337
343
# from the isoband::isobands() docs:
338
344
# the intervals specifying isobands are closed at their lower boundary
You can’t perform that action at this time.
0 commit comments