-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWinstonExamples.jl
More file actions
73 lines (51 loc) · 1.22 KB
/
WinstonExamples.jl
File metadata and controls
73 lines (51 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
require("winston.jl")
import Winston.*
using Winston
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"))
file(p, "example1.png")
%-------------------------------------------%
using Winston
srand(42)
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")
%-------------------------------------------%
using Winston
p = FramedPlot(
title="Title",
xlabel="X axis",
ylabel="Y axis")
add(p, Histogram(hist(randn(1000))...))
add(p, PlotLabel(.5, .5, "Histogram", color=0xcc0000))
t1 = Table(1, 2)
t1[1,1] = p
t1[1,2] = p
t2 = Table(2, 1)
t2[1,1] = t1
t2[2,1] = p
file(t2, "example3.png")
%-------------------------------------------%
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)
file(p, "example2.png")