Skip to content

Add cap argument#592

Open
grantmcdermott wants to merge 6 commits into
mainfrom
caption
Open

Add cap argument#592
grantmcdermott wants to merge 6 commits into
mainfrom
caption

Conversation

@grantmcdermott
Copy link
Copy Markdown
Owner

@grantmcdermott grantmcdermott commented May 20, 2026

Closes #576

Note: I settled on the shorter cap (versus caption) argument to better mirror sub, lab etc.

MWE

pkgload::load_all("~/Documents/Projects/tinyplot")
#> ℹ Loading tinyplot
tinyplot(Sepal.Length ~ Petal.Length | Species, data = iris,
         main = "Some flowers",
         sub = "The iris dataset",
         cap = "Source: Anderson (1935)",        
         theme = "clean")

Customization:

tinytheme("clean", col.cap = "grey50", adj.cap = 0)
tinyplot(Sepal.Length ~ Petal.Length | Species, data = iris,
         main = "Some flowers",
         sub = "The iris dataset",
         cap = "Source: Anderson (1935)")

One caveat is that sub and cap are effectively substitutes for non-dynamic plots. But I've been careful to document this.

tinytheme()
tinyplot(Sepal.Length ~ Petal.Length, data = iris,
        main = "`sub` and `cap` overlap for default theme",
        sub = "Subtitle", cap = "Caption")

Created on 2026-05-20 with reprex v2.1.1

@grantmcdermott
Copy link
Copy Markdown
Owner Author

Sorry to tag for a review again @zeileis and @vincentarelbundock. But this is the penultimate design-based change that I want to roll into the upcoming v0.7.0 release. (The final one will be a reworking of some of our existing themes, plus adding some new ones.)

So I'd appreciate you just casting a quick eye over the API and giving a thumbs up if you approve.

@vincentarelbundock
Copy link
Copy Markdown
Collaborator

Looks good to me! Nice that you added all the tpar() to control it too.

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.

Support plot caption

2 participants