Skip to content

Add "alt" label #4477

Closed
Closed

Description

@hadley

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.

Activity

  1. added this to the ggplot2 3.3.4 milestone on May 17, 2021
  2. added
    feature
    on May 17, 2021
  3. thomasp85 commented on May 18, 2021

    @thomasp85
    Member

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions