Skip to content

assign pt.lwd for type "p" in legend#320

Merged
grantmcdermott merged 2 commits intograntmcdermott:mainfrom
kscott-1:pt-lwd-patch
Feb 18, 2025
Merged

assign pt.lwd for type "p" in legend#320
grantmcdermott merged 2 commits intograntmcdermott:mainfrom
kscott-1:pt-lwd-patch

Conversation

@kscott-1
Copy link
Copy Markdown
Contributor

@kscott-1 kscott-1 commented Feb 17, 2025

Fixes #319. Looking at the issue I posted earlier, it appears that the jitter plot is internally referenced as "p" type. While my knowledge of this codebase is next to nothing, I don't believe there should be unintended consequences of this change because "p" should only include points. The changes allow for the legend to pick up the lwd argument in the case that the pch used during plotting can be impacted by that value. Happy to hear more if I have misunderstood this :)

set.seed(0)
x <- rep(c("A", "B", "C"), each = 20)
y <- runif(60)
gp <- sample(c("X", "Y", "Z"), size = 60, replace = TRUE)
df <- data.frame(x, y, gp)

library(tinyplot)
utils::packageVersion("tinyplot")
#> [1] '0.3.0.99'
plt(
  y ~ x | gp,
  data = df,
  pch = 0:2,
  lwd = 4,
  type = type_jitter()
)

Signed-off-by: Kyle Scott <kms309@miami.edu>
@grantmcdermott
Copy link
Copy Markdown
Owner

Thanks @kscott-1, good catch!

Do you mind adding/committing a short NEWS.md item under the "Bugs fixes" section? Please include your GH handle too, so that folks know who to credit.

I'll merge once that's done.

Signed-off-by: Kyle Scott <kms309@miami.edu>
@kscott-1
Copy link
Copy Markdown
Contributor Author

Thanks @grantmcdermott, let me know if that works for you. Glad I could contribute to a great project.

@vincentarelbundock
Copy link
Copy Markdown
Collaborator

This is very cool. Thanks for the bug fix!

@grantmcdermott grantmcdermott merged commit 9a56785 into grantmcdermott:main Feb 18, 2025
@grantmcdermott
Copy link
Copy Markdown
Owner

Thanks!

@grantmcdermott
Copy link
Copy Markdown
Owner

(Your PR also reminded me of a separate issue related to handing of character variables and default types, which I'll address separately.)

@kscott-1 kscott-1 deleted the pt-lwd-patch branch February 18, 2025 01:32
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.

lwd not respected in legend for type_jitter

3 participants