Skip to content

Commit 6b113c9

Browse files
committed
include scale transforms
1 parent 6f04c09 commit 6b113c9

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

R/scales-.R

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ ScalesList <- ggproto("ScalesList", NULL,
105105
function(scale) scale$transform_df(df = df)
106106
), recursive = FALSE)
107107

108-
data_frame0(!!!transformed, df[setdiff(names(df), names(transformed))])
108+
df[names(transformed)] <- transformed
109+
df
109110
},
110111

111112
backtransform_df = function(self, df) {
@@ -140,10 +141,8 @@ ScalesList <- ggproto("ScalesList", NULL,
140141
}
141142
), recursive = FALSE)
142143

143-
data_frame0(
144-
!!!backtransformed,
145-
df[setdiff(names(df), names(backtransformed))]
146-
)
144+
df[names(backtransformed)] <- backtransformed
145+
df
147146
},
148147

149148
# `aesthetics` is a list of aesthetic-variable mappings. The name of each

tests/testthat/test-layer.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,8 @@ test_that("attributes on layer data are preserved", {
172172
})
173173
# At the end of plot building, we want to retrieve that metric
174174
ld <- layer_data(
175-
ggplot(mpg, aes(drv, hwy, colour = factor(year))) + new + facet_grid(~year)
175+
ggplot(mpg, aes(drv, hwy, colour = factor(year))) + new + facet_grid(~year) +
176+
scale_y_sqrt()
176177
)
177178
expect_equal(attr(ld, "test"), "preserve me")
178179
})

0 commit comments

Comments
 (0)