In [1]:
+(2, 2)
Out[1]:
In [2]:
# Add Cairo before Winston
#Pkg.add("Cairo")
In [3]:
#Pkg.add("Winston")
In [4]:
#Pkg.update()
In [5]:
using Winston
In [6]:
t = linspace(0, 4pi, 1000);
f(x::Array) = 10x.*exp(-0.3x).*sin(3x);
g(x::Array) = 0.03x.*(2pi-x).*(4pi-x);
h(x::Array) = 1./(1+x.^2);
In [7]:
y1 = f(t);
y2 = g(t);
y3 = h(t);
In [8]:
plot(t, y1, "b--")
Out[8]:
In [9]:
plot(t, y2, "r--")
Out[9]:
In [10]:
plot(t, y3, "g--")
Out[10]:
In [11]:
plot(t, y1, "b-", t, y2, "r-", t, y3, "g-")
Out[11]:
In [12]:
plot(t, y1, "b-")
oplot(t, y2, "r-")
oplot(t, y3, "g-")
Out[12]:
In [13]:
plot(t, y1, "b-")
plot(t, y2, "r-")
plot(t, y3, "g-")
Out[13]:
In [14]:
a = randn(1000);
ha = hist(a, 100);
In [15]:
plothist(ha)
Out[15]:
In [16]:
using Distributions
In [17]:
xvals = rand(Normal(100, 20), 1000);
hxvals = hist(xvals, 50);
In [18]:
plothist(hxvals)
Out[18]:
In [19]:
# As opposed to plot() which can take multiple functions
# fplot() can only plot a single function
fplot(x -> sin(x^2), [0,8], "b")
Out[19]:
In [20]:
# To plot more than one function, use hold()
fplot(sin, [-2pi,2pi], "r")
hold()
fplot(cos, [-2pi,2pi], "b")
Out[20]:
In [21]:
#semilogy(y2, y3)
#title("A semilog scale on the x-axis")
In [25]:
plot(t, y1, "b")
title("The function")
xlabel("X value")
ylabel("Y value")
text(7, 10, "Hello!")
Out[25]:
In [ ]: