Weave.jl/examples/julia_sample.mdw

41 lines
837 B
Plaintext

# Introducion to Weave
This a sample [Julia](http://julialang.org/) noweb document that can
be executed using Weave. Output from code chunks and PyPlot
plots will be included in the weaved document. You also need to install Pweave from GitHub in order to use Weave.
This documented can be turned into Pandoc markdown with captured
result from Julia prompt.
~~~~{.julia}
using Weave
weave("examples/julia_sample.mdw")
~~~~
## Terminal chunk
<<term=true>>=
x = 1:10
d = Dict("Weave" => "testing")
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:
<<echo=false; fig_cap="Random walk."; label="random">>=
plot(cumsum(randn(1000, 1)))
@