Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R markdown - including an svg image with tooltips generated using RSVGTipsDevice package

Tags:

r

svg

knitr

I want to include an svg image in an .Rmd document. The svg is created using the RSVGTipsDevice package as I want the image to have some tooltips. The problem is that after the image has been included into the generated HTML document, the tooltips do not work anymore. Although they work properly when I open the svg in a browser (link to image, hover over red rectangle to see the tooltip).

http://www.gridhub.uni-bremen.de/public/pics/plot.svg

Here is the complete .Rmd code:

```{r}
library(RSVGTipsDevice)
devSVGTips("plot.svg", toolTipMode=1)
  plot(0, type="n")
  setSVGShapeToolTip("A rectangle","it is red")
  rect(.1,.1,.4,.6, col='red')
dev.off()
```

![alt text](plot.svg)

The question is: How can I make the tooltips work?

like image 1000
Mark Heckmann Avatar asked Jul 14 '13 17:07

Mark Heckmann


1 Answers

Does my comment help? To be clear, the ![alt text](plot.svg) portion becomes <img src="plot.svg"> which is not a proper way to include svg. To prove this works, I've provided the source and its output.

like image 82
Carson Avatar answered Oct 16 '22 04:10

Carson