Comments (3)
Fixed this in 70e4d62
Added title
and desc
arguments to dsvg
function. You can set them in girafe
function and they'll be forwarded.
The result is that:
title
anddesc
sub-elements are added to thesvg
elementaria-labelledby
andaria-describedby
attributes are added to thesvg
elementrole
attribute (role='img') is added to thesvg
element
Here is a minimal example:
library(ggplot2)
library(ggiraph)
dat <- mtcars
dat$carname <- row.names(mtcars)
gg <- ggplot(data = dat) +
geom_point_interactive(aes(
x = wt, y = qsec, color = disp,
tooltip = paste(carname, disp, sep = "\n"),
data_id = carname
)) +
theme_minimal()
x <- girafe(ggobj = gg_point, title = "ggiraph is cool!", desc = "very very cool!")
print(x)
Be aware that when using the title
argument, the browser will use it as a tooltip for the whole svg an it may class with the interactive elements' tooltip, as you can see in the example above.
from ggiraph.
I preferred to stick with the w3c naming and use title
and desc
instead of alt-title
and alt-desc
.
As for the caption, we'd like to leave it out for now.
If you really want a caption you can accomplish it by other way, for example enclose the widget in a figure element with a figcaption.
Additionally, with the quarto develpment going on, this could by accomplished with quarto code.
from ggiraph.
In fact would be good to implement alt_title
, alt_desc
& caption
as per https://co-analysis.github.io/govuk-hugo-demo/section/render_svg/
from ggiraph.
Related Issues (20)
- legend not plotting when using `scale_linetype_manual()` and `scale_colour_manual()` HOT 4
- Enable ability to change SVG role for accessibility HOT 1
- Output preprocessor for R Shiny testing HOT 2
- Respect RNG seed for SVG IDs HOT 3
- girafe and piping HOT 2
- Transparent background HOT 2
- ggiraph fails to install error code 1 HOT 1
- Could geom_*_interactive support trailing comma's? HOT 1
- Specifying svg_width/height changes legend pattern HOT 1
- geom_col_interactive() ignoring specified order of stacked bars (duplicate of #265) HOT 2
- y-axis alignment issue when changing fonts HOT 2
- geom_hline_interactive with coord_polar not working HOT 4
- Toolbar elements initial state HOT 2
- ggiraph is not working with R 4.4.0 for Windows HOT 7
- geom_boxplot_interactive() doesn't work. HOT 1
- Set display=none as default for automaticall created divs HOT 7
- apply default css properties to data_id elements HOT 1
- Responsive sizing of text elements HOT 4
- Hover effect not behaving as expected on spaghetti plots since ggiraph 0.8.9
- geom_line_interactive wrong labels with few data points
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ggiraph.