Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

double caption in finalize #141

Open
matthewstern opened this issue Nov 5, 2021 · 2 comments
Open

double caption in finalize #141

matthewstern opened this issue Nov 5, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@matthewstern
Copy link
Contributor

A common use of the caption grob produced by finalize_plot is to provide both a "note" and a "source" that should be a bit separate from each other. Most examples in the cookbook, for example, include <br><br> between text to create the necessary visual spacing.

A logical and easy add would be to allow the caption argument to take a vector of text entries, which finalize_plot would then combine with the necessary line breaks in the backend.

@matthewstern matthewstern added the enhancement New feature or request label Nov 5, 2021
@nmpeterson
Copy link
Contributor

As long as it remains backwards-compatible (i.e. a single string can still be supplied to the parameter, not wrapped in a c()) I have no problem with this. I guess it would just be a matter of checking whether the supplied value is a vector and, if so, returning cat(the_vector, sep = "<br><br>")?

@matthewstern
Copy link
Contributor Author

yeah, I'm not even sure you'd need to check:

> caption <- c("This is a note.", "This is a source.")
> paste(caption, collapse = "<br><br>")
[1] "This is a note.<br><br>This is a source."

> caption <- "This is a note."
> paste(caption, collapse = "<br><br>")
[1] "This is a note."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants