In [6]:
Pkg.add("Plots")
Pkg.add("PyPlot")
Pkg.add("GR")
Pkg.add("UnicodePlots")
Pkg.add("PlotlyJS")
In [1]:
using Plots
In [2]:
plotly(); x = 1:0.1:10; plot(sin,x)
Out[2]:
In [3]:
gr(); x = 1:0.1:10; plot(sin,x)
Out[3]:
In [4]:
pyplot(); x = 1:0.1:10; plot(sin,x)
Out[4]:
In [48]:
using DataFrames
In [53]:
slideData = readtable("slideTimes.csv",separator=';');
In [60]:
Out[60]:
In [56]:
bar(slideData[:time],nbins=10)
Out[56]:
In [5]:
plotly(); plot(sin, cos, -pi, pi,aspect_ratio=1)
Out[5]:
In [6]:
scatter(rand(100),rand(100))
Out[6]:
In [7]:
bar(rand(100))
Out[7]:
In [8]:
histogram(rand(100),nbins=10)
Out[8]:
In [9]:
histogram2d(rand(1000),rand(1000),nbins=10)
Out[9]:
In [42]:
using DataFrames
In [43]:
studentData = readtable("HomeworkVSexamClean.csv",separator=';');
In [44]:
describe(studentData)
In [45]:
histogram2d(studentData[:homework],studentData[:exam],nbins=10)
Out[45]:
In [47]:
histogram2d(studentData[:homework],studentData[:exam],nbins=10,yflip=true)
Out[47]:
In [13]:
pie(["Sugar","Flour","Egg","Love"],[1,2,0.5,1])
Out[13]:
In [14]:
contour(-10:10,-10:10, (x,y) -> exp(Complex(x,y))/Complex(x,y)^10 |> abs |> log10)
Out[14]:
In [15]:
contour(-10:10,-10:10, (x,y) -> exp(Complex(x,y))/Complex(x,y)^10 |> abs |> log10,fill=true)
Out[15]:
In [125]:
using SpecialFunctions
In [16]:
contour(-10:10,-10:10, (x,y) -> airyai(x + y*im)/(x+y*im)^10 |> abs |> log10,fill=true)
Out[16]:
In [17]:
contour(-10:0.1:10,-10:0.1:10, (x,y) -> airyai(x + y*im)/(x+y*im)^10 |> abs |> log10,fill=true)
Out[17]:
In [18]:
x = -2:0.1:2;
y = x;
z = [exp(-(x^2+y^2)) for x in x, y in y];
heatmap(x,y,z)
Out[18]:
In [19]:
surface(x,y,z)
Out[19]:
In [20]:
surface(x,y,(x,y) -> exp(-(x^2+y^2)))
Out[20]:
In [21]:
wireframe(x,y,(x,y) -> exp(-(x^2+y^2)))
Out[21]:
In [22]:
plot3d(sin,cos,identity,-2pi,2pi)
Out[22]:
In [23]:
plot(sin,-pi:0.1:pi,line=(:red,10,:dot),label="sin")
Out[23]:
In [24]:
plot(sin,-pi:0.1:pi,line=(:solid,10,:cyan),label="sin",m=(3,:cross,:yellow))
Out[24]:
In [25]:
bar(["Episode 1","Episode 2", "Episode 3",
"A New Hope", "The Empire Strikes Back","The Return of the Jedi"],
[0,2,2,20,30,20]
)
Out[25]:
In [26]:
bar(["Episode 1","Episode 2", "Episode 3",
"A New Hope", "The Empire \n Strikes Back","The Return \n of the Jedi"],
[0,2,2,20,30,20]
)
Out[26]:
In [27]:
bar(["Episode 1","Episode 2", "Episode 3",
"A New Hope", "The Empire \n Strikes Back","The Return \n of the Jedi"],
[0,2,2,20,30,20],
legend = false
)
Out[27]:
In [28]:
bar(["Episode 1","Episode 2", "Episode 3",
"A New Hope", "The Empire \n Strikes Back","The Return \n of the Jedi"],
[0,2,2,20,30,20],
legend=false,
title="Favorite Star Wars Movie",
xlabel="Episode",
ylabel="Awesomeness"
)
Out[28]:
In [29]:
bar(["Episode 1","Episode 2", "Episode 3",
"A New Hope", "The Empire \n Strikes Back","The Return \n of the Jedi"],
[0,2,2,20,30,20],
legend=false,
title="Favorite Star Wars Movie",
xlabel="Episode",
ylabel="Awesomeness",
annotations=(0,1,"Jar Jar Binks Fail")
)
Out[29]:
In [30]:
bar(["Episode 1","Episode 2", "Episode 3",
"A New Hope", "The Empire \n Strikes Back","The Return \n of the Jedi"],
[0,2,2,20,30,20],
legend=false,
title="Favorite Star Wars Movie",
xlabel="Episode",
ylabel="Awesomeness",
annotations=[(0.5,3,text("Jar Jar Binks \n Fail",10,:red)),(4.5,33,"Peak")],
)
Out[30]:
In [31]:
bar(["Episode 1","Episode 2", "Episode 3",
"A New Hope", "The Empire \n Strikes Back","The Return \n of the Jedi"],
[0,2,2,20,30,20],
legend=false,
title="Favorite Star Wars Movie",
xlabel="Episode",
ylabel="Awesomeness",
annotations=[(0.5,3,text("Jar Jar Binks \n Fail",10,:red)),(4.5,33,"Peak")],
ylims=[0,35]
)
Out[31]:
In [32]:
bar(["Episode 1","Episode 2", "Episode 3",
"A New Hope", "The Empire \n Strikes Back","The Return \n of the Jedi"],
[0,2,2,20,30,20],
legend=false,
title="Favorite Star Wars Movie",
xlabel="Episode",
ylabel="Awesomeness",
annotations=[(0.5,3,text("Jar Jar Binks \n Fail",10,:red)),(4.5,33,"Peak")],
ylims=[0,35]
)
Out[32]:
In [33]:
bar(["Episode 1","Episode 2", "Episode 3",
"A New Hope", "The Empire \n Strikes Back","The Return \n of the Jedi"],
[0,2,2,20,30,20]
)
Out[33]:
In [34]:
bar(["Episode 1","Episode 2", "Episode 3",
"A New Hope", "The Empire <br> Strikes Back","The Return <br> of the Jedi"],
[0,2,2,20,30,20]
)
#legend(false)
title!("Favorite Star Wars Movie")
xlabel!("Episode")
ylabel!("Aswesomeness")
annotate!([(0.5,3,text("Jar Jar Binks <br> Fail",10,:red)),(4.5,33,"Peak")])
ylims!(0,35)
Out[34]:
In [35]:
plot(sin,-pi:0.1:pi)
plot!(cos,-pi:0.1:pi)
scatter!(tan,rand(-pi:0.3:pi,10))
Out[35]:
In [36]:
p1 = plot(sin,-pi:0.1:pi);
p2 = plot(cos,-pi:0.1:pi);
p3 = plot(tan,-pi:0.1:pi);
plot(p1,p2,p3,layout=3)
Out[36]:
In [37]:
l = @layout([a{0.3w} b; c])
Out[37]:
In [38]:
plot(p1,p2,p3,layout=l)
Out[38]:
In [39]:
pyplot(); Plots.PyPlot.xkcd();
In [40]:
x = 1:0.1:10; plot(sin,x,margin=1cm)
Out[40]:
In [41]:
gr()
@gif for i in 0:0.1:2pi
plot(x -> sin(x+i),0:0.1:2pi)
end
Out[41]:
Recreate the following image.
The heart shape may be generated using the parametrization
$$ \begin{align*} h \colon &[-\pi,\pi] \to \mathbb{R}\\ &t \mapsto (16sin^3(t), 13cos(t)-5cos(2t)-2cos(3t)-cos(4t)). % h_x(t) &= 16sin^3(t) \\ % h_y(t) &= 13cos(t)-5cos(2t)-2cos(3t)-cos(4t) \end{align*} $$Hint: The package LaTeXStrings is useful for createing the title.
In [ ]: