-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFigures-and-subplots.jl
48 lines (43 loc) · 1.26 KB
/
Figures-and-subplots.jl
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
# Translating
# https://proplot.readthedocs.io/en/latest/basics.html#Figures-and-subplots
# to Julia
# Import proplot using PyCall
using PyCall
proplot = pyimport("proplot")
# start of example
data = cumsum(2(rand(100, 5) .- 0.5), dims=1)
# Simple plot
f, axs = proplot.subplots(ncols=2)
axs[1].plot(data, lw=2)
axs[1].format(xticks=20, xtickminor=false)
[ax.format(
suptitle="Simple subplot grid", title="Title",
xlabel="x axis", ylabel="y axis"
) for ax in axs]
f.savefig("figs/Figures-and-subplots-1.svg", transparent=false)
# Complex grid
array = [ # the "picture"; 1 == subplot a, 2 == subplot b, etc.
[1, 1, 2, 2],
[0, 3, 3, 0],
]
f, axs = proplot.subplots(array, axwidth=1.8)
[ax.format(
abc=true, abcloc="ul", suptitle="Complex subplot grid",
xlabel="xlabel", ylabel="ylabel"
) for ax in axs]
axs[3].plot(data, lw=2)
f.savefig("figs/Figures-and-subplots-2.svg", transparent=false)
# Really complex grid
array = [ # the "picture"
[1, 1, 2],
[1, 1, 6],
[3, 4, 4],
[3, 5, 5],
]
f, axs = proplot.subplots(array, width=5, span=false)
[ax.format(
suptitle="Really complex subplot grid",
xlabel="xlabel", ylabel="ylabel", abc=true
) for ax in axs]
axs[1].plot(data, lw=2)
f.savefig("figs/Figures-and-subplots-3.svg", transparent=false)