Weave.jl/examples/julia_sample.mdw

41 lines
837 B
Plaintext
Raw Normal View History

2014-11-25 00:10:48 +01:00
# Introducion to Weave
2014-11-25 00:10:48 +01:00
This a sample [Julia](http://julialang.org/) noweb document that can
be executed using Weave. Output from code chunks and PyPlot
2020-05-06 16:37:04 +02:00
plots will be included in the weaved document. You also need to install Pweave from GitHub in order to use Weave.
2014-11-25 00:10:48 +01:00
This documented can be turned into Pandoc markdown with captured
result from Julia prompt.
~~~~{.julia}
using Weave
2014-11-25 00:10:48 +01:00
weave("examples/julia_sample.mdw")
~~~~
## Terminal chunk
<<term=true>>=
2014-11-25 00:10:48 +01:00
x = 1:10
2016-10-30 17:50:02 +01:00
d = Dict("Weave" => "testing")
2014-11-25 00:10:48 +01:00
y = [2, 4 ,8]
@
## Capturing figures
The figures and code can be included in the output.
<<>>=
using PyPlot
t = linspace(0, 2*pi, 100)
plot(t, sinc(t))
xlabel("x")
ylabel("sinc(x)")
@
You can also include a plot with caption and hide the code:
2014-12-04 21:10:24 +01:00
<<echo=false; fig_cap="Random walk."; label="random">>=
2014-11-25 00:10:48 +01:00
plot(cumsum(randn(1000, 1)))
@