Skip to content

Commit

Permalink
Computes breaks with the krigged data
Browse files Browse the repository at this point in the history
  • Loading branch information
eliocamp committed Sep 4, 2024
1 parent 3bbff9f commit f0ab422
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
14 changes: 7 additions & 7 deletions R/stat_contour2.r
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,6 @@ StatContour2 <- ggplot2::ggproto("StatContour2", ggplot2::Stat,
ywrap = NULL, na.fill = FALSE, global.breaks = TRUE,
proj = NULL, proj.latlon = TRUE, kriging = FALSE,
clip = NULL) {
if (isFALSE(global.breaks)) {
breaks <- setup_breaks(data,
breaks = breaks,
bins = bins,
binwidth = binwidth)
}

data.table::setDT(data)

data <- data[!(is.na(y) | is.na(x)), ]
Expand Down Expand Up @@ -166,6 +159,13 @@ StatContour2 <- ggplot2::ggproto("StatContour2", ggplot2::Stat,
data <- suppressWarnings(WrapCircular(data, "y", ywrap))
}

if (isFALSE(global.breaks)) {
breaks <- setup_breaks(data,
breaks = breaks,
bins = bins,
binwidth = binwidth)
}

data.table::setDF(data)
dec <- getOption("OutDec")
options(OutDec = ".")
Expand Down
14 changes: 6 additions & 8 deletions R/stat_contour_fill.R
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,6 @@ StatContourFill <- ggplot2::ggproto("StatContourFill", ggplot2::Stat,
proj = NULL, proj.latlon = TRUE, kriging = FALSE,
clip = NULL) {
data.table::setDT(data)

if (isFALSE(global.breaks)) {
breaks <- setup_breaks(data,
breaks = breaks,
bins = bins,
binwidth = binwidth)
}

data <- data[!(is.na(y) | is.na(x)), ]

if (!isFALSE(na.fill)) {
Expand Down Expand Up @@ -141,6 +133,12 @@ StatContourFill <- ggplot2::ggproto("StatContourFill", ggplot2::Stat,
data <- suppressWarnings(WrapCircular(data, "y", ywrap))
}

if (isFALSE(global.breaks)) {
breaks <- setup_breaks(data,
breaks = breaks,
bins = bins,
binwidth = binwidth)
}

# Make contours
dec <- getOption("OutDec")
Expand Down

0 comments on commit f0ab422

Please sign in to comment.