Saving Incanter graphs to PNG
So far, we've been viewing the graphs we've created in a window on our computer. This is extremely handy, especially to quickly generate a graph and see what's in it. However, the chart would be more useful if we could save it. Then we could embed it in Word documents or web pages or print it so that we can hang it on the wall.
In this recipe, we'll save a graph of the iris data that we created in Creating scatter plots with Incanter.
Getting ready
We'll use the same dependencies in our project.clj
file as we did in Creating scatter plots with Incanter, and this set of imports in our script or REPL:
(require '[incanter.core :as i] '[incanter.charts :as c])
We'll also use the chart object that we created in Creating scatter plots with Incanter, and we'll keep using the iris-petal-scatter
variable name for it.
How to do it...
Since we already have the chart, saving it is simple. We just call incanter.core/save
on...