Mark Heckmann
Mark Heckmann

Reputation: 11431

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

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?

Upvotes: 7

Views: 4413

Answers (1)

Carson
Carson

Reputation: 2757

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.

Upvotes: 3

Related Questions