using Gadfly, RDatasets
diamonds = dataset("ggplot2", "diamonds");
p = plot(diamonds, x = "Carat", y = "Price", color = "Clarity")
- It's probably best to generate plots in an interactive session, then save to your favorite file format:
draw(PDF("diamonds.pdf", 8inch, 6inch), p);
draw(PNG("diamonds.png", 8inch, 6inch), p);
draw(SVG("diamonds.svg", 8inch, 6inch), p);
draw(SVGJS("diamonds.js.svg", 8inch, 6inch), p);
SVGJS
has ability to pan and zoom (include in your HTML docs like so):
<div align = "center">
<object src="diamonds.js.svg" type="image/svg+xml"></object>
</div>