Skip to content

Commit 7b85fd0

Browse files
Use panel_guides_grob() in CoordTransform
1 parent b70fe0a commit 7b85fd0

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed

R/coord-cartesian-.r

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ view_scales_from_scale <- function(scale, coord_limits = NULL, expand = TRUE) {
137137
view_scales <- list(
138138
view_scale_primary(scale, limits, continuous_range),
139139
sec = view_scale_secondary(scale, limits, continuous_range),
140-
arrange = scale$axis_order(),
141140
range = continuous_range
142141
)
143142
names(view_scales) <- c(aesthetic, paste0(aesthetic, ".", names(view_scales)[-1]))

R/coord-transform.r

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -164,20 +164,16 @@ CoordTrans <- ggproto("CoordTrans", Coord,
164164
},
165165

166166
render_axis_h = function(panel_params, theme) {
167-
arrange <- panel_params$x.arrange %||% c("secondary", "primary")
168-
169167
list(
170-
top = render_axis(panel_params, arrange[1], "x", "top", theme),
171-
bottom = render_axis(panel_params, arrange[2], "x", "bottom", theme)
168+
top = panel_guides_grob(panel_params$guides, position = "top", theme = theme),
169+
bottom = panel_guides_grob(panel_params$guides, position = "bottom", theme = theme)
172170
)
173171
},
174172

175173
render_axis_v = function(panel_params, theme) {
176-
arrange <- panel_params$y.arrange %||% c("primary", "secondary")
177-
178174
list(
179-
left = render_axis(panel_params, arrange[1], "y", "left", theme),
180-
right = render_axis(panel_params, arrange[2], "y", "right", theme)
175+
left = panel_guides_grob(panel_params$guides, position = "left", theme = theme),
176+
right = panel_guides_grob(panel_params$guides, position = "right", theme = theme)
181177
)
182178
}
183179
)
@@ -228,12 +224,10 @@ view_scales_from_scale_with_coord_trans <- function(scale, coord_limits, trans,
228224
out$sec.minor_source <- transform_value(trans, out$sec.minor_source, out$range)
229225

230226
out <- list(
231-
view_scale_primary(scale, scale_limits, continuous_ranges$continuous_range_coord),
232-
# TODO: currently, view_scale_secondary() requires the range that's not affected by
233-
# the Coord transformation. I'm not yet sure if this is necessary or it's
234-
# just I don't figure out the whole process.
227+
# Note that a ViewScale requires a limit and a range that are before the
228+
# Coord's transformation, so we pass `continuous_range`, not `continuous_range_coord`.
229+
view_scale_primary(scale, scale_limits, continuous_ranges$continuous_range),
235230
sec = view_scale_secondary(scale, scale_limits, continuous_ranges$continuous_range),
236-
arrange = scale$axis_order(),
237231
range = out$range,
238232
labels = out$labels,
239233
major = out$major_source,

0 commit comments

Comments
 (0)