In [3]:
using Plots
using Colors
gr()
Out[3]:
In [4]:
base03=parse(Colorant,"#002b36");
base02=parse(Colorant,"#073642");
base01=parse(Colorant,"#586e75");
base00=parse(Colorant,"#657b83");
base0=parse(Colorant,"#839496");
base1=parse(Colorant,"#839496");
base2=parse(Colorant,"#eee8d5");
base3=parse(Colorant,"#fdf6e3");
yellow=parse(Colorant,"#b58900");
orange=parse(Colorant,"#cb4b16");
red=parse(Colorant,"#dc322f");
magenta=parse(Colorant,"#d33682");
violet=parse(Colorant,"#6c71c4");
blue=parse(Colorant,"#268bd2");
cyan=parse(Colorant,"#3aa198");
green=parse(Colorant,"#859900");
display([base03, base02, base01,base00,base0,base1,base2,base3])
display([yellow,orange,red,magenta,violet,blue,cyan,magenta])
In [5]:
x=collect(0:.1:4π);
y1=sin.(x);
y2=cos.(x);
y3=sin.(2*x);
y4=cos.(2*x);
y5=sin.(x/2);
In [6]:
plot(x,y1,label="leg label")
plot!(title="Title",
xlabel="x label",
ylabel="y label")
Out[6]:
In [7]:
plot(x,y1,legend=false)
Out[7]:
In [8]:
plot(x,y1,
annotation=(x[10],y1[10],"Hi!"))
Out[8]:
In [9]:
plot(x,y1)
annotate!(x[10],y1[10],"Hello World!")
Out[9]:
In [10]:
plot(x,y1)
annotate!(x[10],y1[10],text("Hello World!",:left))
annotate!(x[60],y1[60],text("Right and Red",:right,magenta,45.))
annotate!(x[70],y1[70],text("Right and Red",font(:right,magenta,45.)))
Out[10]:
In [14]:
f=font(:center,magenta,45.)
println(f,"\t",typeof(f))
plot(x,y1)
annotate!(10*rand(),rand(),text("Point 1",f))
annotate!(10*rand(),rand(),text("Point 2",f))
annotate!(10*rand(),rand(),text("Point 3",f))
Out[14]:
In [31]:
plot(x,y1,
xticks=[0,π,2π,3π,4π],
yticks=[-1,-.5,0,.5,1] )
Out[31]:
In [21]:
pyplot()
plot(x,y1,formatter=:scientific)
Out[21]:
In [28]:
function mylabel(num::Real)
if isapprox(num,π)
return "π"
elseif isapprox(num,0)
return "0"
end
num2=num/π
for ii in 1:10
if isapprox(num2,ii)
return "$ii π"
elseif isapprox(num,-ii)
return "-$ii π"
end
end
return "$num"
end
Out[28]:
In [35]:
pyplot()
plot(x,y1,
xticks=[0,π,2π,3π,4π],
formatter=mylabel)
Out[35]:
In [37]:
gr()
plot(x,y1,
ylims=[-.5,.5])
Out[37]:
In [36]:
gr()
plot(x,y1,
rotation=45)
Out[36]:
In [51]:
plot(factorial.(1:20),
yscale=:log10)
Out[51]:
In [53]:
plot(x,y1,
xflip=true)
Out[53]:
In [55]:
plot(x,y1,
legend=:bottomright)
Out[55]:
In [ ]: