Dana Paige Seidel
Tidyverse Meeting, August 6, 2018
Merged PRs in 3 tidyverse packages: scales, ggplot2, and lubridate!
In scales 1.0.0, log_breaks()
returns integer multiples of integer powers of base when finer breaks are needed (@ThierryO, #117).
Upon release this will change the default breaks of every scale_*_log10()
call in ggplot2
number_format()
provides a generic formatter for numbers (@larmarange, #142).pvalue_format()
formats p-valuesbyte_format()
and bytes()
format numeric vectors into byte measurements.time_format()
formats POSIXt
and hms
objectsordinal_format
scale
, accuracy
, trim
, big.mark
, decimal.mark
, prefix
, suffix
etc.boxcox_trans()
has been refactored to be invertible and include an offset.modulus_trans()
implements the modulus transformation for positive and negative values.pseudo_log_trans()
for transforming numerics into a signed logarithmic scale with a smooth transition to a linear scale around 0.Since ggplot2 3.0.0 was release about halfway through my internship, I started with a lot of docs.
Several PRs just doing careful review of documentation of the most visited reference sites and general cleaning (spell-check, consistency)
Linux Foundation, Core Infrastructure Initiative Best Practices Badging
My notes about the procedure for ggplot2. More detail in Issue 2700.
Feature : allow certain default aesthetics to be set by the plot theme.
theme_dark()
)Custom themes can now set a default colour
, colour accents (useful for things like geom_smooth()
), fill
, a fill accent, and/or alpha
.
Other aesthetics like size
or linetype
could be added as well, for now the PR only addresses colour aesthetics.
Aesthetic and parameter behaviour is left intact – mapped aesthetics override defaults, and parameters override both.
my_theme <- theme(geom = element_geom(colour = "purple",
fill = "darkblue"))
ggplot(mpg, aes(displ, hwy)) + geom_point() + my_theme
ggplot(mpg, aes(displ, hwy)) + geom_col() + my_theme
theme_dark()
now with lighter fill and colour defaults.ggplot(mpg, aes(displ, hwy, shape = drv)) +
geom_point() + theme_dark()
After discussion with @thomasp85, I simplified the AxisSecondary
code to fix sec.axis
behaviour for log transforms
df <- data.frame(x = c("A", "B", "C"),
y = c(10, 100, 1000))
ggplot(data = df, aes(x, y)) +
geom_point() +
scale_y_log10(sec.axis = dup_axis())
The simplest way to do this was to incorporate the primary axis transformation directly into the creation of the secondary scale:
By incorporating the primary axes transformation in the source, it’s trivial to add secondary axis support for date and datetime scales (upcoming PR).
This was mostly an adventure in curiosity (for both Irene and I!) but would be a nice international feature to add. Currently at least one user is turning to plotly
to do this because html handles text encoding better and the placement of the primary axis can be user specified.
Adjusting coord_flip
into a new coord_mirror
, creating theme_rtl()
to set proper text and legend alignment, and implementing scale_x_reverse()
with continuous axes, allows for right to left plotting in ggplot2.
Obviously a polished solution would combine all three of these into a single command or setting.
This currently resides only on a branch of my fork but perhaps soon to a PR near you!
#> Error in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
#> polygon edge not found