Skip to content

Commit c86c9c7

Browse files
CRAN v0.6.0 (#529)
* news and version bump * cran comments * ignore tests on CRAN * readme tweak * v0.6.0 submission * parttree revdep catch * more layering alignment safeguards * revert test ignore for ci * tweak test * check tests for ci * namespace and document * alphabetical order (aesthetic tweak) * resubmission * revert test ignore for ci
1 parent 20c136f commit c86c9c7

17 files changed

+105
-81
lines changed

CRAN-SUBMISSION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
Version: 0.5.0
2-
Date: 2025-09-21 18:31:22 UTC
3-
SHA: a0d3b9a79ee0f33db7841eba7e3e583cde73ee8e
1+
Version: 0.6.0
2+
Date: 2025-11-26 21:36:13 UTC
3+
SHA: 3080d0ab861e2cf1f6d463e4784a8d4f6653a6d4

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Package: tinyplot
22
Type: Package
33
Title: Lightweight Extension of the Base R Graphics System
4-
Version: 0.5.0.99
5-
Date: 2025-09-21
4+
Version: 0.6.0
5+
Date: 2025-11-26
66
Authors@R:
77
c(
88
person(

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ importFrom(grDevices,cairo_pdf)
5050
importFrom(grDevices,col2rgb)
5151
importFrom(grDevices,colorRampPalette)
5252
importFrom(grDevices,convertColor)
53+
importFrom(grDevices,dev.cur)
5354
importFrom(grDevices,dev.list)
5455
importFrom(grDevices,dev.new)
5556
importFrom(grDevices,dev.off)

NEWS.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ _If you are viewing this file on CRAN, please check the
44
[latest NEWS](https://grantmcdermott.com/tinyplot/NEWS.html) on our website
55
where the formatting is also better._
66

7-
## Dev version
7+
## v0.6.0
88

99
### Breaking changes
1010

@@ -76,7 +76,7 @@ where the formatting is also better._
7676
`tinyplot()` and that it thus has access to the local definition to all
7777
variables such as `x` and `y` etc. (#507 @zeileis)
7878

79-
## 0.5.0
79+
## v0.5.0
8080

8181
### New features
8282

@@ -138,7 +138,7 @@ where the formatting is also better._
138138
with the CI implementation.
139139
- Add a `devcontainer.json` file for remote testing. (#480 @grantmcdermott)
140140

141-
## 0.4.2
141+
## v0.4.2
142142

143143
### New features
144144

@@ -169,7 +169,7 @@ where the formatting is also better._
169169
can also call them in a base plot layer, relaxing the requirement that they
170170
must be called as part of a subsequent plot layer via `tinyplot_add()`. (#422 @grantmcdermott)
171171

172-
## 0.4.1
172+
## v0.4.1
173173

174174
### Bug fixes
175175

@@ -180,7 +180,7 @@ where the formatting is also better._
180180

181181
- Revert minimum compatible R version to 4.0.0 (#416 @grantmcdermott)
182182

183-
## 0.4.0
183+
## v0.4.0
184184

185185
### New features:
186186

@@ -278,7 +278,7 @@ where the formatting is also better._
278278
logic was mostly an artifact of development inertia and this new nesting logic
279279
should simplify the creation of certain plot types. (#331 @grantmcdermott)
280280

281-
## 0.3.0
281+
## v0.3.0
282282

283283
### New features
284284

@@ -453,7 +453,7 @@ grouping variables (thanks to @strengjacke for reporting #213).
453453
- The new functional type processing system also means that each type now
454454
has its own help page (e.g. `?type_hist`, `type_ridge`, etc.)
455455

456-
## 0.2.1
456+
## v0.2.1
457457

458458
New Features:
459459

@@ -502,7 +502,7 @@ Internals:
502502
- Revamped formula processing that allows for better sanity checking and
503503
edge-case logic. (#197 @zeileis)
504504

505-
## 0.2.0
505+
## v0.2.0
506506

507507
New features:
508508

@@ -530,7 +530,7 @@ Misc:
530530

531531
- Various documentation improvements.
532532

533-
## 0.1.0
533+
## v0.1.0
534534

535535
Our first CRAN submission! This v0.1.0 release includes the following new
536536
features and updates:
@@ -626,7 +626,7 @@ approach). (#145 @vincentarelbundock & @grantmcdermott)
626626
calculates `density` grid coords. (#150 @grantmcdermott)
627627

628628

629-
## 0.0.5
629+
## v0.0.5
630630

631631
**IMPORTANT BREAKING CHANGE:**
632632

@@ -670,7 +670,7 @@ see the following GitHub comment, as well as the discussion that preceded it:
670670
https://github.com/grantmcdermott/plot2/issues/22#issuecomment-1928472754
671671

672672

673-
## 0.0.4
673+
## v0.0.4
674674

675675
Website:
676676

@@ -727,7 +727,7 @@ outer gap to outside of the graphics device unchanged. (#94 @grantmcdermott)
727727
- Fix bug where grid wasn't auto-expanding correctly for area plots. (#92
728728
@grantmcdermott)
729729

730-
## 0.0.3
730+
## v0.0.3
731731

732732
Breaking changes:
733733

@@ -765,7 +765,7 @@ Bug fixes:
765765
- Setting a global palette, e.g. `palette("ggplot2")` is now respected. (#44
766766
@grantmcdermott)
767767

768-
## 0.0.2
768+
## v0.0.2
769769

770770
Breaking changes:
771771

@@ -792,6 +792,6 @@ Project:
792792
- @vincentarelbundock and @zeileis have joined the project as core contributors.
793793
🎉
794794

795-
## 0.0.1
795+
## v0.0.1
796796

797797
* Initial release on GitHub.

R/align_layer.R

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,24 @@
11
# Ensure added layers respect the x-axis order of the original plot layer
22
# (e.g., when adding lines or ribbons on top of errorbars)
33
align_layer = function(settings) {
4-
# Retrieve xlabs from current and original layers
4+
# Retrieve xlabs and plot/device metadata from original layer
5+
tinyplot_env = get(".tinyplot_env", envir = parent.env(environment()))
6+
xlabs_orig = tryCatch(get("xlabs_orig", envir = tinyplot_env), error = function(e) NULL)
7+
usr_orig = tryCatch(get("usr_orig", envir = tinyplot_env), error = function(e) NULL)
8+
dev_orig = tryCatch(get("dev_orig", envir = tinyplot_env), error = function(e) NULL)
9+
10+
# Validate that we're adding to the same plot (not a stale xlabs from previous plot)
11+
if (is.null(usr_orig) || is.null(dev_orig) || dev_orig != dev.cur()) {
12+
return(invisible())
13+
}
14+
# Normalize current usr for comparison (accounting for flipped plots)
15+
usr_layer = if (isTRUE(settings$flip)) par("usr")[c(3,4,1,2)] else par("usr")
16+
if (!identical(usr_orig, usr_layer)) {
17+
return(invisible())
18+
}
19+
20+
# xlabs of current layer
521
xlabs_layer = settings[["xlabs"]]
6-
xlabs_orig = get("xlabs", envir = get(".tinyplot_env", envir = parent.env(environment())))
722

823
# Only adjust if original layer has named xlabs
924
if (!is.null(names(xlabs_orig))) {

R/tinyplot.R

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@
368368
#' out existing `plot` calls for `tinyplot` (or its shorthand alias `plt`),
369369
#' without causing unexpected changes to the output.
370370
#'
371-
#' @importFrom grDevices axisTicks adjustcolor cairo_pdf colorRampPalette extendrange palette palette.colors palette.pals hcl.colors hcl.pals xy.coords png jpeg pdf svg dev.off dev.new dev.list
371+
#' @importFrom grDevices axisTicks adjustcolor cairo_pdf colorRampPalette dev.cur dev.list dev.off dev.new extendrange hcl.colors hcl.pals jpeg palette palette.colors palette.pals pdf png svg xy.coords
372372
#' @importFrom graphics abline arrows axis Axis axTicks box boxplot grconvertX grconvertY hist lines mtext par plot.default plot.new plot.window points polygon polypath segments rect text title
373373
#' @importFrom utils modifyList head tail
374374
#' @importFrom stats na.omit setNames
@@ -871,7 +871,7 @@ tinyplot.default = function(
871871

872872
# ensure axis aligment of any added layers
873873
if (!add) {
874-
assign("xlabs", settings[["xlabs"]], envir = get(".tinyplot_env", envir = parent.env(environment())))
874+
assign("xlabs_orig", settings[["xlabs"]], envir = get(".tinyplot_env", envir = parent.env(environment())))
875875
} else {
876876
align_layer(settings)
877877
}
@@ -1340,6 +1340,14 @@ tinyplot.default = function(
13401340
#
13411341

13421342
if (!add) {
1343+
# Capture device and usr before recordGraphics (in current plot context)
1344+
current_dev = dev.cur()
1345+
current_usr = if (isTRUE(settings$flip)) par("usr")[c(3,4,1,2)] else par("usr")
1346+
1347+
# Store usr and dev for validating layer alignment
1348+
assign("usr_orig", current_usr, envir = get(".tinyplot_env", envir = parent.env(environment())))
1349+
assign("dev_orig", current_dev, envir = get(".tinyplot_env", envir = parent.env(environment())))
1350+
13431351
recordGraphics(
13441352
{
13451353
apar = par(no.readonly = TRUE)

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ tinyplot(Sepal.Length ~ Petal.Length | Species, data = iris) # formu
9393

9494
If you would prefer to save on a few keystrokes, you can use the
9595
shorthand `plt()` alias instead of typing out `tinyplot()` in full.
96-
Here’s the same plot with this shorthand alias, plus a few aesthetic
97-
tweaks:
96+
Here’s the same plot with this shorthand `plt()` alias, as well as an
97+
added `"lm"` layer and a few aesthetic tweaks:
9898

9999
``` r
100100
plt(
@@ -103,6 +103,7 @@ plt(
103103
palette = "dark", pch = 16,
104104
grid = TRUE, frame = FALSE
105105
)
106+
plt_add(type = "lm")
106107
```
107108

108109
<img src="man/figures/README-quickstart3-1.png" style="width:70.0%" />
@@ -114,6 +115,7 @@ built-in themes for convenient plot customization:
114115
tinytheme("clean2")
115116

116117
plt(Sepal.Length ~ Petal.Length | Species, data = iris)
118+
plt_add(type = "lm")
117119
```
118120

119121
<img src="man/figures/README-quickstart_theme-1.png"

README.qmd

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,9 @@ tinyplot(Sepal.Length ~ Petal.Length | Species, data = iris) # formu
105105
```
106106

107107
If you would prefer to save on a few keystrokes, you can use the shorthand
108-
`plt()` alias instead of typing out `tinyplot()` in full. Here's the
109-
same plot with this shorthand alias, plus a few aesthetic tweaks:
108+
`plt()` alias instead of typing out `tinyplot()` in full. Here's the same plot
109+
with this shorthand `plt()` alias, as well as an added `"lm"` layer and a few
110+
aesthetic tweaks:
110111

111112
```{r quickstart3}
112113
plt(
@@ -115,6 +116,7 @@ plt(
115116
palette = "dark", pch = 16,
116117
grid = TRUE, frame = FALSE
117118
)
119+
plt_add(type = "lm")
118120
```
119121

120122
Speaking of aesthetic tweaks, **tinyplot** also provides a set of built-in
@@ -124,6 +126,7 @@ themes for convenient plot customization:
124126
tinytheme("clean2")
125127
126128
plt(Sepal.Length ~ Petal.Length | Species, data = iris)
129+
plt_add(type = "lm")
127130
```
128131

129132
Themes are persistent and will be applied to subsequent plots. For example, here

cran-comments.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
## Overview
22

3-
**tinyplot** v0.5.0 a minor release with some new features and bug fixes.
3+
**tinyplot** v0.6.0 a minor release containing mostly bug fixes.
4+
5+
_Note:_ This is a re-submission that fixes a regression discovered by CRAN's
6+
revdep checks (specific to the **parttree** package). Apologies for missing it
7+
the first time around.
48

59
## Test environments
610
Arch Linux (local)

inst/tinytest/_tinysnapshot/pointrange_with_layers_flipped.svg

Lines changed: 37 additions & 49 deletions
Loading

0 commit comments

Comments
 (0)