In [1]:
# Declaramos la variable de entorno "PYTHON" vacia.
ENV["PYTHON"]=""
Pkg.update()
In [4]:
ENV["PYTHON"] = ""
using Plots, StatPlots, PlotRecipes
Plots with Plots.jl, Tom Breloff
In [3]:
plot(Plots.fakedata(50,5),w=3)
Out[3]:
Aquí los macros son programas creados de antemano y utilizados de manera fácil. Por ejemplo: @layout. Así que el layout puede entrar directamente (como veremos, o através de un macro). Por ejemplo, dentro de plot:
In [6]:
plot(randn(100,5),layout= 5,
t=[:line :histogram :scatter :steppre :bar],leg=false,ticks=nothing,border=false)
Out[6]:
In [7]:
l = @layout [a{0.1h};b [c;d e]]
plot(randn(100,5),layout= l,
t=[:line :histogram :scatter :steppre :bar],leg=false,ticks=nothing,border=false)
Out[7]:
In [9]:
plotattr(:Series)
In [14]:
plot(rand(100), line = (:steppre, :dot, :arrow, 0.5, 4, :red))
Out[14]:
In [15]:
plot(rand(100), fill = (0, 0.5, :red))
Out[15]:
In [16]:
scatter(rand(100), marker = (:hexagon, 20, 0.6, :green, stroke(3, 0.2, :black, :dot)))
Out[16]:
In [12]:
vs = readdlm("omni2_14800.lst")
Out[12]:
In [13]:
matricita = [vs[:,5:7] vs[:,10] vs[:,11]]
Out[13]:
In [18]:
etiqs = ["Bx" "By" "Bz" "Vel" "Dst"]
equis = ["" "" "" "" "June 2012"]
plot(matricita, layout = (5,1), fill=(0,0.3,:blue), ylabel = etiqs,
xlabel = equis, xticks = nothing)
Out[18]:
In [19]:
vsref = readdlm("omni2_486.txt")
Out[19]:
In [20]:
matref = [vsref[:,5:7] vsref[:,10] vsref[:,11] ]
Out[20]:
In [21]:
etiqsr = ["Bx" "By" "Bz" "Vel" "Dst"]
equisr = ["" "" "" "" "November 2003"]
plot(matref, layout = (5,1), fill=(0,0.3,:blue), ylabel = etiqsr,
xlabel = equisr, xticks = nothing)
Out[21]:
Para comparar estos dos eventos, vamos a tomar 11 días de datos. Para el primero, que fue en día 16, tomaremos del 11 al 21, y para el segundo, que fue en día 20, tomaremos del 15 al 25.
In [22]:
tiempo1 = vs[:,1]+(vs[:,2]/365)+(vs[:,3]/(24*365))
tiempo2 = vsref[:,1]+vsref[:,2]/365+vsref[:,3]/(24*365)
Out[22]:
In [23]:
s1 = plot(tiempo1, vs[:,10])
s2 = plot(tiempo2, vsref[:,10])
plot(s1, s2, layout = (2,1))
Out[23]:
In [24]:
plot(matricita[241:504,:], layout = (5,1), fill=(0,0.3,:blue), ylabel = etiqs,
xlabel = equis, xticks = nothing)
plot!(matref[225:509,:], layout = (5,1), fill=(0,0.3,:red), ylabel = etiqsr,
xlabel = equisr, xticks = nothing)
Out[24]:
In [46]:
#imf = [vs[:,5:7]]
#imf = [vs[:,5:7] vs[:,5:7]] #como los voy a usar 2 veces, así los pongo en la matriz
imf = [vs[:,5] vs[:,5] vs[:,6] vs[:,6] vs[:,7] vs[:,7]] # otra opción
Out[46]:
In [48]:
la0 = @layout [[a b];[c d];[d e]]
la = @layout [[a; b; c] [d e; f g]]
la1 = @layout [[a{0.7w} b]; [c d]; [e f]]
plot(imf, layout = la1, t = [:line :histogram],
fill=(0,0.3,:green))
Out[48]:
In [49]:
markers = setdiff(supported_markers(),[:none,:auto,Shape])'
n = length(markers)
x = (linspace(0,10,n + 2))[2:end - 1]
y = repmat(reverse(x)',n,1)
scatter(x,y,m=(8,:auto),lab=map(string,markers),bg=:linen,xlim=(0,10),ylim=(0,10))
Out[49]:
In [50]:
styles = setdiff(supported_styles(),[:auto])'
plot(cumsum(randn(20,length(styles)),1),style=:auto,label=map(string,styles),w=5)
Out[50]:
In [51]:
linetypes = [:path :steppre :steppost :sticks :scatter]
n = length(linetypes)
x = Vector[sort(rand(20)) for i = 1:n]
y = rand(20,n)
plot(x,y,line=(linetypes,3),lab=map(string,linetypes),ms=15)
Out[51]:
In [ ]: