mirror of https://github.com/mpastell/Weave.jl
60 lines
959 B
Plaintext
60 lines
959 B
Plaintext
|
|
||
|
<<term=true>>=
|
||
|
using Winston
|
||
|
t = linspace(0, 2*pi, 100)
|
||
|
plot(t, sinc(t))
|
||
|
s = 1:10
|
||
|
plot(s, "r*")
|
||
|
@
|
||
|
|
||
|
|
||
|
|
||
|
<<echo=false; fig_cap="Random walk."; label="random"; fig_width=8; fig_height=4>>=
|
||
|
p = plot(cumsum(randn(1000, 1)))
|
||
|
xlabel("x")
|
||
|
ylabel("sinc(x)")
|
||
|
display(p)
|
||
|
@
|
||
|
|
||
|
|
||
|
<<dpi=200>>=
|
||
|
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)
|
||
|
|
||
|
p = FramedPlot(
|
||
|
aspect_ratio=1,
|
||
|
xrange=(0,100),
|
||
|
yrange=(0,100))
|
||
|
|
||
|
n = 21
|
||
|
x = linspace(0, 100, n)
|
||
|
yA = 40 .+ 10randn(n)
|
||
|
yB = x .+ 5randn(n)
|
||
|
|
||
|
a = Points(x, yA, kind="circle")
|
||
|
setattr(a, label="a points")
|
||
|
|
||
|
b = Points(x, yB)
|
||
|
setattr(b, label="b points")
|
||
|
style(b, kind="filled circle")
|
||
|
|
||
|
s = Slope(1, (0,0), kind="dotted")
|
||
|
setattr(s, label="slope")
|
||
|
|
||
|
l = Legend(.1, .9, {a,b,s})
|
||
|
|
||
|
add(p, s, a, b, l)
|
||
|
display(p)
|
||
|
@
|