Skip to content

Legend labels when by is logical#512

Merged
grantmcdermott merged 4 commits intomainfrom
logic-factor
Nov 19, 2025
Merged

Legend labels when by is logical#512
grantmcdermott merged 4 commits intomainfrom
logic-factor

Conversation

@grantmcdermott
Copy link
Copy Markdown
Owner

Fixes #505

@grantmcdermott
Copy link
Copy Markdown
Owner Author

MWE:

pkgload::load_all("~/Documents/Projects/tinyplot")
#> ℹ Loading tinyplot

dat = data.frame(y= 1:3, x= 1:3, yesno= c(T, F, T))

tinyplot(y ~ x | yesno, data = dat, cex = 3, pch = 16)

Aside: This ended up being a little more complicated than first expected, since you can't introduce the same logical -> factor coercion for x and y (b/c it creates downstream problems for any types that rely on predict internally, like type_lm, type_loess, etc). As a result, this doesn't give you the desired outcome out of the gate:

tinyplot(y ~ yesno | x, data = dat, cex = 3, pch = 16)

To "fix", you need an explicit coercion to factor as part of the call:

tinyplot(y ~ factor(yesno) | x, data = dat, cex = 3, pch = 16, type = "p")

I'd love to provide a robust fix for the this x/y logical issue down the line (which doesn't mess up the predict-dependent methods, but that will take more time than I have right now.

@grantmcdermott grantmcdermott merged commit 3ea04d8 into main Nov 19, 2025
3 checks passed
@grantmcdermott grantmcdermott deleted the logic-factor branch November 19, 2025 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

by should support logical types

1 participant