Open marius311 opened 5 years ago
@marius311 : Thanks for the code. Unfortunately, I still couldn't make it work, being new to Julia. Here's what I did. Inserted your code into a file called preweave.jl
along with the line using Weave
at the top of the file. Called the preweave.jl
file by running include("preweave.jl")
in REPL followed by setup_weave_pyplot()
. Ended up with the error UndefVarError: preexecute_hooks not defined
. Can you please explain what I need to do to make your code work?
I was interested in having native PyPlot support for some of the reasons I mentioned here.
After asking that, I was able to hack together something which basically works. Essentially, for any chunk which you give
pyplot=true
as an option, it automatically inserts a hiddenclf()
at the start of the chunk and agcf()
at the end, which makes it so that Weave correctly displays the PyPlot figure generated in that chunk.The code is pretty simple (given below), you just have to call
setup_weave_pyplot
before weaving, or you can even just do it in a hidden code cell in your report.I'm curious if there's any interest in me cleaning this up and submitting a PR? Or is it too hacky? I can definitely understand either way.