R bloggers (including me) typically post plots online as portable network graphics (PNG). This is silly because plots generally work better as vector graphics. For years I’ve wanted to host scalable vector graphics (SVG) online, but none of the image hosting sites support them.
In case you don’t know, SVGs are awesome.
- The are vector graphics, so they’re small and resolution isn’t an issue.
- They support animation.
- You can edit them in Inkscape.
- You can edit them in a text editor.
- You can parse them with an XML parser.
- You can edit them really easily with scripts.
- And web browsers support them.
Since vector graphics are reasonably small, I’m happy to host them, but you can also host them on your own server of course.
Now for a demonstration (and a preview of my next blog post).
So you plot your plot with the svg device.
> plot_searches(subjects,tweet_text.R,ignore.case=T,main=’What are people tweeting about? (case-insensitive)’)
Then you upload it. Then you copy the embed code into your blog post. Voilà.
And then you continue writing your blog post as if this were any other image.