There's not a way to put them on separate pdf pages, but you can stack them 
and output them to the same pdf like:

using Gadfly
x = [1,2,3]
plot1 = plot(x = x, y = x + 3)
plot2 = plot(x = x, y = 2 * x + 1)
draw(PDF("plotJ.pdf", 6inch, 6inch), vstack(plot1, plot2))


On Friday, February 7, 2014 8:35:57 AM UTC-8, G. Patrick Mauroy wrote:
>
> Just starting taking a look at Julia.  I have seen examples on how to send 
> a plot to a file.  But I have not stumbled upon one example as yet to 
> export multiple plots to the same file, say pdf.
> Can someone please point me in the right direction?
>
> # R example of what I would like to do.
>
> x = 1:3
>
> pdf(file = "plotR.pdf")
>
> plot(x = x, y = x + 3)
>
> plot(x = x, y = 2 * x + 1)
>
> dev.off()
>
>
> # My first Julia attempt.
>
> using Gadfly
>
> x = [1,2,3]
>
> plot1 = plot(x = x, y = x + 3)
>
> plot2 = plot(x = x, y = 2 * x + 1)
>
> draw(PDF("plotJ.pdf", 6inch, 3inch), plot1)
>
> draw(PDF("plotJ.pdf", 6inch, 3inch), plot2)
>
>
> Pb: plot2 overrides plot1, so only plot2 in plotJ.pdf.
>
>
> To be clear, in this example, I want plot1 & plot2 in two distinct 
> plots/pages -- as opposed to merge both graphs into one plot.
>
>
> Thanks.
>
>

Reply via email to