aquaticapetheory
aquaticapetheory

Reputation: 313

How to make Julia's Weave package properly handle multiple plots in a document?

I am trying to generate simple documents using Weave. I have a Julia script in a .jl file. Verbiage is in comments, code is on its own lines.

I am using the Plots package with GR or PyPlots. I generate two plots. The code for these two plots is separated by text blocks. Looks something like this:

using Plots

#' Paragraph 1
plot( randn(16) )
hline!( [0] )

#' Paragraph 2
plot( rand(32) )
hline!( [0,1] )

The problem is that when I run this, I get the paragraphs, I get the code snippets, and I get 2 plot figures but both the plot figures are the same plot: the last one. I've tried adding #+ lines to separate the code chunks, I've tried adding the term=true option, I've tried reuse=false for the plot commands, still the same repeated plot. With the term=true option it actually creates 3 plots and they are in the wrong order.

How do I properly handle multiple plot figures in a Weave script?

More system info: Running on a mac. Julia version 1.9.0 and Weave 0.10.12. This happens both when running in VSCode (I don't use the plot pane) and in a Julia REPL that runs by itself in a terminal.

Upvotes: 1

Views: 203

Answers (0)

Related Questions