access_img | R Documentation |
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.
access_img( img = last_plot(), alt = NULL, wid = NULL, ht = NULL, dpi = 300, css_class = NULL, css_id = NULL )
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. |
Inline HTML with the necessary structure for screen reader accessibility.
# 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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.