Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@ where the formatting is also better._

### Bug fixes

- Fixed bug where single-valued discrete axes would trigger invalid `par(usr)`
values when combined with free facets. (#668 @grantmcdermott)
- Fixed several bugs specific to plots with free facets (i.e.,
`facet.args = list(free = TRUE)`):
- Single-valued discrete axes no longer trigger invalid `par(usr)` values.
(#668 @grantmcdermott)
- User-provided `x/ylim` overrides now work correctly with flipped plots.
(#670 @grantmcdermott)

## v0.7.0

Expand Down
1 change: 1 addition & 0 deletions R/flip.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ flip_datapoints = function(settings) {
swap_elements(settings, "xlab", "ylab")
swap_elements(settings, "xlabs", "ylabs")
swap_elements(settings, "xlim", "ylim")
swap_elements(settings, "null_xlim", "null_ylim")
swap_elements(settings, "rev_x", "rev_y")
swap_elements(settings, "xmax", "ymax")
swap_elements(settings, "xmin", "ymin")
Expand Down
159 changes: 159 additions & 0 deletions inst/tinytest/_tinysnapshot/facet_free_flip.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions inst/tinytest/test-facet.R
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,19 @@ f = function() {
}
expect_snapshot_plot(f, label = "facet_free_single_value")

# Free facets combined with flip: the fixed continuous-axis limit must follow
# the flip and be honoured, rather than the wrong axis being freed (issue #670)
f = function() {
tinyplot(
mpg ~ carb, data = mtcars, type = "p",
facet = ~am, facet.args = list(free = TRUE),
ylim = c(0, 50),
flip = TRUE,
main = "Free facets: flipped"
)
}
expect_snapshot_plot(f, label = "facet_free_flip")

#
# restore original par settings
#
Expand Down