Skip to content

Commit

Permalink
Don't round - instead use faster version of scales package.
Browse files Browse the repository at this point in the history
Fixes #1022
  • Loading branch information
hadley committed Jul 21, 2015
1 parent ae1303f commit 8434e4c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Expand Up @@ -21,7 +21,7 @@ Imports:
MASS,
plyr (>= 1.7.1),
reshape2,
scales (>= 0.2.3),
scales (>= 0.2.5.9001),
stats
Suggests:
ggplot2movies,
Expand Down
4 changes: 4 additions & 0 deletions NEWS
@@ -1,6 +1,10 @@
ggplot2 1.0.1.9xxx
----------------------------------------------------------------

* Scales no longer round data points to improve performance of colour
palettes. Instead the scales package now uses a much faster colour
interpolation algorithm (#1022).

* `scale_x_date()` now clips dates outside the limits in the same way as
`scale_x_continuous()` (#1090)

Expand Down
5 changes: 0 additions & 5 deletions R/scale-.r
Expand Up @@ -292,11 +292,6 @@ scale_map <- function(scale, x, limits) UseMethod("scale_map")
scale_map.continuous <- function(scale, x, limits = scale_limits(scale)) {
x <- scale$oob(scale$rescaler(x, from = limits))

# Points are rounded to the nearest 500th, to reduce the amount of
# work that the scale palette must do - this is particularly important
# for colour scales which are rather slow. This shouldn't have any
# perceptual impacts.
x <- round_any(x, 1 / 500)
uniq <- unique(x)
pal <- scale$palette(uniq)
scaled <- pal[match(x, uniq)]
Expand Down

0 comments on commit 8434e4c

Please sign in to comment.