Skip to content

Commit

Permalink
Merge pull request #165 from Fan-iX/main
Browse files Browse the repository at this point in the history
Avoid tint color shift caused by the `limits` parameter in `scale_*_hypso_tint_b` and `scale_*_hypso_tint_c`
  • Loading branch information
dieghernan authored Jan 23, 2025
2 parents d0512d9 + d056dfd commit c487144
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions R/scales_hypso.R
Original file line number Diff line number Diff line change
Expand Up @@ -480,8 +480,8 @@ scale_fill_hypso_tint_c <- function(palette = "etopo1_hypso", ...,

if (is.null(values)) values <- hypsocol$limit
# Reescale
res <- scales::rescale(values)
if (is.null(limits)) limits <- range(values)
res <- scales::rescale(values, from = limits)

ggplot2::scale_fill_gradientn(...,
colors = hexcol,
Expand Down Expand Up @@ -524,8 +524,8 @@ scale_colour_hypso_tint_c <- function(palette = "etopo1_hypso", ...,

if (is.null(values)) values <- hypsocol$limit
# Reescale
res <- scales::rescale(values)
if (is.null(limits)) limits <- range(values)
res <- scales::rescale(values, from = limits)

ggplot2::scale_colour_gradientn(...,
colors = hexcol,
Expand Down Expand Up @@ -569,8 +569,8 @@ scale_fill_hypso_tint_b <- function(palette = "etopo1_hypso", ...,

if (is.null(values)) values <- hypsocol$limit
# Reescale
res <- scales::rescale(values)
if (is.null(limits)) limits <- range(values)
res <- scales::rescale(values, from = limits)

ggplot2::scale_fill_stepsn(
...,
Expand Down Expand Up @@ -614,8 +614,8 @@ scale_colour_hypso_tint_b <- function(palette = "etopo1_hypso", ...,

if (is.null(values)) values <- hypsocol$limit
# Reescale
res <- scales::rescale(values)
if (is.null(limits)) limits <- range(values)
res <- scales::rescale(values, from = limits)

ggplot2::scale_colour_stepsn(
...,
Expand Down

0 comments on commit c487144

Please sign in to comment.