Weave.jl icon indicating copy to clipboard operation
Weave.jl copied to clipboard

Compose with Gadfly doesn't support pdf figure output.

Open zaphar opened this issue 5 years ago • 3 comments

Details are in https://github.com/GiovineItalia/Compose.jl/issues/372 It's possible that this just needs to be noted in the documentation until Compose supports show methods for pdf output. Or Weave could shim in a show method until then.

Setting the chunk option fig_ext=".png" or another supported format appears to workaround it.

zaphar avatar Dec 17 '19 01:12 zaphar

Note this issue only occurs with hstack'd or vstack'd plots. Same with any Compose.Context. The workaround I found was to explicitly include a draw call:

draw(PDF(), hstack(plot1, plot2));

Mattriks avatar Dec 17 '19 11:12 Mattriks

Looking at Weave.jl src now. The issue is that hstack'd and vstack'd plots are no longer objects of type Gadfly.Plot, as they are converted to objects of type Compose.Context.

Weave's gadfly.jl file defines display methods only for Gadfly.Plot. But Gadfly's display methods are defined for Union{Gadfly.Plot, Compose.Context}, so I think this is what needs to be done in Weave.jl. This would also enable Compose graphics in Weave.

Mattriks avatar Dec 17 '19 16:12 Mattriks

Yeah, I can confirm that this works in a simple test as well.

zaphar avatar Dec 18 '19 03:12 zaphar