label_number_si() now correctly uses SI prefixes (e.g. abbreviations “k” for “kilo-” and “m” for “milli-”). It previously used short scale abbreviations (e.g. “M” for million, “B” for billion). The short scale is most commonly used in finance, so it is now supported via the new
rescale_large argument of
label_dollar() (@davidchall, #235).
label_number_si() now requires the
unit argument is specified. The default value of the
accuracy argument is now
NULL, which automatically chooses the precision. The
sep argument is removed, which had no purpose (@davidchall, #235).
label_dollar() gains a
rescale_large argument to support scaling of large numbers by suffix (e.g. “M” for million, “B” for billion). In finance, the short scale is most prevalent (i.e. 1 billion = 1 thousand million). In other contexts, the long scale might be desired (i.e. 1 billion = 1 million million). These two common scales are supported by setting
rescale_large = rescale_short_scale() or
rescale_large = rescale_long_scale(), but custom scaling-by-suffix is also supported (@davidchall, #235).
precision(), used when
accuracy = NULL, now does a better job when duplicate values are present (@teunbrand, #251). It also does a better job when there’s a mix of finite and non-finite values (#257).
oob_keep() to keep data outside range, allowing for zoom-limits when
oob_keep is used as
oob argument in scales. Existing out of bounds functions have been renamed with the
oob_-prefix to indicate their role (@teunbrand, #255).
Axis breaks and labels have a new naming scheme: functions that generate breaks from limits are called
breaks_; functions that generate labels from breaks are called
number_bytes_format() with a more convenient interface. It takes a single
unit argument which can either be an SI unit (e.g. “kB”), a binary unit (e.g. “kIB”), or an automatic unit (either “auto_si” or “auto_binary”).
label_bytes("auto_binary")(1024^(1:3)) #>  "1 kiB" "1 MiB" "1 GiB"
label_date_short() creates labels for a date axis that only show the components of the date that have changed since the previous label. For example, if you have Jan 10, Jan 20, Jan 30, and Feb 1,
label_date_short() will use labels Jan 10, 20, 30, Feb 1 (#209).
label_math() now returns an expression vector, and doesn’t coerce inputs to names.
label_number() now picks the accuracy automatically by default. The underlying heuristic has been improved to use the distance between adjacent breaks (rather than the total range of the break).
label_number_auto() automatically picks between
scientific_format() based on the range of the input. It should produce nice output over a very wide range of inputs (@paleolimbot, #208).
The built in breaks functions now returns a function that takes both a range and a desired number of breaks, making it possible to overwrite the defaults number of desired breaks given in the constructor call (@thomasp85).
breaks_width() which allows you to specify a fixed distance between breaks (along with optional offset).
scales now uses the farver package for colour manipulation instead of a combination of grDevices and hand-rolled C++ code (#223).
DiscreteRange methods now properly inherit and are fully mutable (@dpseidel).
col_factor() now have a
reverse parameter, to apply color palettes in the opposite of their usual order (i.e. high-to-low instead of low-to-high) (@jcheng5, #191).
col_quantile() now take a
right argument, which is passed to
base::cut(); it indicates whether the bin/quantile intervals should be closed on the right (and open on the left), or vice versa (@jcheng5, #191).
col_factor() now tries to avoid interpolating qualitative RColorBrewer palettes. Instead, it attempts to assign a palette color to each factor level. Interpolation will still be used if there are more factor levels than available colors, and a warning will be emitted in that case (@jcheng5, #191).
scales functions now work as expected when it is used inside a for loop. In previous package versions if a scales function was used with variable custom parameters inside a for loop, some of the parameters were not evaluated until the end of the loop, due to how R lazy evaluation works (@zeehio, #81).
Switched from reference classes to R6 (#96).
scale_continuous() uses a more correct check for numeric values.
NaN is correctly recognised as a missing value by the gradient palettes (ggplot2-1482).
dollar_format() is now more flexible and can add either prefixes or suffixes for different currencies (#53). It gains a
negative_parens argument to show negative values as
($100) and now passes missing values through unchanged (@dougmitarotonda, #40).
to_time(), but that function was moved into a function so it was no longer available in the scales namespace. Now
floor_time() has its own copy of that function (Thanks to Stefan Novak).
zero_range() has improved behaviour thanks to Brian Diggs.
time_trans() gains an optional argument
tz to specify the time zone to use for the times. If not specified, it will be guess from the first input with a non-null time zone.
fixed namespace problem with
train_continuous() so zero-row or all infinite data frames don’t potentially cause problems.
check for zero-length colour in
log_breaks() always gives breaks evenly spaced on the log scale, never evenly spaced on the data scale. This will result in really bad breaks for some ranges (e.g 0.5-0.6), but you probably shouldn’t be using log scales in that situation anyway.
bounds functions now
force evaluation of range to avoid bug with S3 method dispatch inside primitive functions (e.g.
Simplified algorithm for
discrete_range() that is robust to
stringsAsFactors global option. Now, the order of a factor will only be preserved if the full factor is the first object seen, and all subsequent inputs are subsets of the levels of the original factor.