Jeremy McNees
Jeremy McNees

Reputation: 787

Output Gadfly Graphics and DataFrame in one SVG, PDF, etc

I'm trying to create a simple report that shows some summary DataFrames along with several graphics. I can write several graphics as SVG for example, but how can I write several graphics and a small DataFrame to a single SVG, or PDF, etc.?

using Gadfly, DataFrames

plot1 = plot(x = rand(10), y = rand(10)) 
plot2 = plot(x = rand(10), y = rand(10)) 

draw(SVG("combined_plost", 5inch, 5inch), hstack(plot1, plot2)) 

Which outputs two plots next to each other, as desired. Now let's say I also want to include a small DataFrame with the two plots above, which contain summary information for example. How can I do this?

Something like this is what i'm asking about:

df = DataFrame()
df[:vars] = collect(1:10) 

draw(SVG("combined_plots", 5inch, 5inch), vstack(hstack(plot1, plot2), df) 

So that I can have my graphics and summary values in a single SVG, or similar format. It doesn't necessarily need to be a DataFrame, some other container or format is acceptable.

Upvotes: 4

Views: 571

Answers (1)

HarmonicaMuse
HarmonicaMuse

Reputation: 7893

You can use IJulia to create an interactive notebook and then export it to PDF and many other formats using nbconvert.

You can test in:

This example was tested in try.jupyter.org:

enter image description here

Note: I couldn't go on and export it in neither site, since converting to PDF requires Inkscape, which is not installed by those providers, but you can install everything locally instead.

Upvotes: 3

Related Questions