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: 4 additions & 4 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ where the formatting is also better._
axis limits for secondary plot layers. (#513 @grantmcdermott)
- Fixed lazy evaluation bug where `legend` passed as a symbol through S3 methods
(e.g., `tinyplot.foo`) would fail. (#515 @grantmcdermott)
- Added layers, particularly from `tinyplot_add()`, should now respect the x-axis
order of the original plot layer. This should ensure that we don't end up with
misaligned layers. For example, when adding a ribbon on top of an errorbar
plot. (#517 @grantmcdermott)
- Added layers, particularly from `tinyplot_add()`, should now respect the
x-axis order of the original plot layer. This should ensure that we don't end
up with misaligned layers. For example, when adding a ribbon on top of an
errorbar plot. (#517, #520 @grantmcdermott)


### Documentation
Expand Down
1 change: 1 addition & 0 deletions R/tinyplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -1217,6 +1217,7 @@ tinyplot.default = function(
datapoints[[dp_var]]
}
)
datapoints = datapoints[order(datapoints[[dp_var]]), ]
} else if (!is.null(names(labs_layer))) {
# case 2: match implicit integer -> label mapping (e.g., lines added to errorbars)
if (setequal(names(labs_layer), names(labs_orig))) {
Expand Down
98 changes: 98 additions & 0 deletions inst/tinytest/_tinysnapshot/pointrange_with_layers_grouped.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions inst/tinytest/test-type_pointrange.R
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,15 @@ fun = function() {
type = type_pointrange(dodge = 0.2))
}
expect_snapshot_plot(fun, label = "pointrange_dodge_01")

# issue #519 layer on top of grouped plots
# (don't care about dodge yet; revist when #493 resolved)

fun = function() {
tinyplot(estimate ~ term | model,
ymin = conf.low, ymax = conf.high,
data = results,
type = type_pointrange())
tinyplot_add(type = 'l')
}
expect_snapshot_plot(fun, label = "pointrange_with_layers_grouped")