Weave.jl/examples/winston_sample.mdw

58 lines
1.2 KiB
Plaintext

# Introducion to JuliaReport
This a sample [Julia](http://julialang.org/) noweb document that can
be executed using JuliaReport. Output from code chunks and Winston
plots will be included in the weaved document. You also need to install Pweave from Github in order to use JuliaReport.
This documented can be turned into Pandoc markdown with captured
result from Julia prompt.
~~~~{.julia}
using JuliaReport
weave(Pkg.dir("JuliaReport","examples","winston_sample.mdw"), plotlib="Winston")
~~~~
## Terminal chunk
<<term=true>>=
x = 1:10
d = {"juliareport" => "testing"}
y = [2, 4 ,8]
@
## Capturing figures
The figures and code can be included in the output.
<<term=true>>=
using Winston
t = linspace(0, 2*pi, 100)
p = plot(t, sinc(t))
@
You can also include a plot with caption and hide the code:
<<echo=false; caption="Random walk."; label="random"; fig_width=8; fig_height=4>>=
p = plot(cumsum(randn(1000, 1)))
xlabel("x")
ylabel("sinc(x)")
display(p)
@
<<>>=
x = linspace(0, 3pi, 100)
c = cos(x)
s = sin(x)
p = FramedPlot(
title="title!",
xlabel="\\Sigma x^2_i",
ylabel="\\Theta_i")
add(p, FillBetween(x, c, x, s))
add(p, Curve(x, c, color="red"))
add(p, Curve(x, s, color="blue"))
display(p)
@