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

Add "alt" label #4477

Closed
hadley opened this issue May 13, 2021 · 1 comment
Closed

Add "alt" label #4477

hadley opened this issue May 13, 2021 · 1 comment
Labels
feature a feature request or enhancement
Milestone

Comments

@hadley
Copy link
Member

hadley commented May 13, 2021

e.g.

plot + labs(
  alt = "This is a plot of diamonds data showing the price increases non-linearly with carat"
)

For now, it would just store the label in an attribute, but the goal would be to plumb it up with knitr so that the plot text automatically made it way to the alt attribute of the html image.

@thomasp85 thomasp85 added this to the ggplot2 3.3.4 milestone May 17, 2021
@thomasp85 thomasp85 added the feature a feature request or enhancement label May 17, 2021
@thomasp85
Copy link
Member

thomasp85 commented May 18, 2021

This is already sorta possible:

p <- ggplot() + labs(alt = 'this is a test')
p$labels$alt
#> [1] "this is a test"

I think what we should provide is a function that takes a plot object and returns the alt-text. This would make it easy for us to iterate and improve upon it without breaking knitr etc since the interface will be unchanged

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

No branches or pull requests

2 participants