access_img {accessrmd} | R Documentation |
Produce an accessible image or chart.
Description
Reads in an image and produces the HTML structure expected by web accessibility checkers such as WAVE. Also works as a wrapper around ggplot2 charts.
Usage
access_img(
img = last_plot(),
alt = NULL,
wid = NULL,
ht = NULL,
dpi = 300,
css_class = NULL,
css_id = NULL
)
Arguments
img |
The image to include as accessible HTML. Defaults to 'ggplot2::last_plot()'. Can be replaced with an image written to disc. |
alt |
A character string describing the image for screen reader accessibility. |
wid |
Width of the image in pixels. |
ht |
Height of the image in pixels. |
dpi |
Resolution. Please see |
css_class |
Specify a css class selector for the image. |
css_id |
Specify a css ID selector for the image. |
Value
Inline HTML with the necessary structure for screen reader accessibility.
Examples
# create a ggplot2 chart
ggplot(pressure, aes(temperature, pressure)) +
geom_point()
# Use 'access_img()' to render the chart with alt text
access_img(alt = "Vapor Pressure of Mercury as a Function of Temperature")
# Create a png.
file.create(tempfile("some_img", fileext = ".png"))
# Read it from disk and include alt text
access_img("some_img.png", alt = "Some meaningful alt text")
[Package accessrmd version 1.0.0 Index]