[This article was first published on James Goldie (rstats posts), and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

I’ve taken over development of ggflags, an extension to ggplot2 that allows you to plot country flags as points or bubbles. The original was developed by Baptiste’s Auguié, and I’ve so far extended it to use round, vector flags from the EmojiOne v2 set (so they’ll look great at any size).

We’re currently working on SVG export for interactive graphics. It works with ggsave if you have the svglite package installed, although you lose the structure of the plot, which isn’t great for interactive applications. gridSVG::grid.export also works, although you’ll have to do some manual tweaking of the output to correct for a bug with the viewport.

Current known issues:

  • When exporting with gridSVG::grid.export, the viewport doesn’t always line up wit the plot properly. This can be corrected by manually tweaking the SVG output.
  • When exporting with ggsave, flags that overlap the edges of the plot area don’t properly clip o nthe boundary. You can pad the plot with expand to mitigate this.
  • Strokes aren’t currently scaling with size properly, but I’m working on it!

If you think you can help me work out these issues, or think the package could do other things, feel free to open an issue or open a pull request! I’m particularly interested in creating a separate package to plot arbitrary sets of SVG icons.

To leave a comment for the author, please follow the link and comment on their blog: James Goldie (rstats posts). offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)