Smart x/ylim arguments#644
Conversation
|
@zeileis @vincentarelbundock Sorry to tag you (again!) but I promise that this is the final time before I submit 0.7.0. I'd like your feedback, since this is an API change (which I like, but you might feel differently). I'm confident in the implementation, so no need to check the internal code. Just let me know whether you like the API. |
There was a problem hiding this comment.
Pull request overview
This PR implements “smart” xlim/ylim override forms in tinyplot, adding support for scalar coverage (ensure a value is included), partial-NA limit pinning, and a "rev(erse)" keyword to reverse automatically computed axis limits (Fixes #616).
Changes:
- Extend
xlim/ylimparsing to support scalar inputs, length-2 partialNA, and"rev(erse)"keyword reversal. - Plumb new
rev_x/rev_yflags through settings, limit computation, flip handling, and facet drawing (including free-scale facets). - Add snapshot tests and documentation/NEWS updates describing the new limit behaviors.
Reviewed changes
Copilot reviewed 7 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| R/zzz.R | Registers new rev_x/rev_y globals to satisfy R CMD check. |
| R/tinyplot.R | Adds docs for new xlim/ylim forms; resolves "rev(erse)" into rev_x/rev_y settings. |
| R/lim.R | Adds resolve_lim() and applies smart limit resolution; reverses finalized limits based on rev_x/rev_y. |
| R/flip.R | Ensures rev_x/rev_y are swapped when flipping axes. |
| R/facet.R | Threads rev_x/rev_y into facet window drawing; attempts to support reversed axes under free facets. |
| NEWS.md | Documents the new “smart” x/ylim override forms. |
| man/tinyplot.Rd | Updates rendered documentation for new xlim/ylim behaviors. |
| man/facet.Rd | Documents new internal rev_x/rev_y parameters for draw_facet_window(). |
| inst/tinytest/test-lim.R | Adds snapshot tests covering scalar coverage, partial-NA pinning, and "reverse" (incl. free facets). |
| inst/tinytest/_tinysnapshot/lim_scalar_zero.svg | New snapshot output for scalar coverage test. |
| inst/tinytest/_tinysnapshot/lim_reverse.svg | New snapshot output for reverse keyword test. |
| inst/tinytest/_tinysnapshot/lim_reverse_free_facet.svg | New snapshot output for reverse keyword with free facets. |
| inst/tinytest/_tinysnapshot/lim_partial_na.svg | New snapshot output for partial-NA pinning test. |
Files not reviewed (2)
- man/facet.Rd: Generated file
- man/tinyplot.Rd: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Fixes #616
MWE
Reference plot for comparison.
Created on 2026-06-23 with reprex v2.1.1