Skip to content

Commit 49107d3

Browse files
committed
matplotlib
1 parent 943a296 commit 49107d3

File tree

3 files changed

+192
-87
lines changed

3 files changed

+192
-87
lines changed

docs/make.jl

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,23 @@ plpath = dirname(pathof(SlimPlotting))
55
ex_path = "$(plpath)/../examples"
66
doc_path = "$(plpath)/../docs"
77

8-
weave("$(ex_path)/plot_example.jl"; out_path="$(doc_path)/src/examples.md", doctype="github")
8+
weave(
9+
"$(ex_path)/plot_example.jl";
10+
out_path = "$(doc_path)/src/examples.md",
11+
doctype = "github",
12+
)
913

10-
makedocs(sitename="Slim Plotting toolbox",
11-
doctest=false, clean=true,
12-
authors="Mathias Louboutin",
13-
pages = Any[
14-
"Home" => "index.md",
15-
"About" => "README.md",
16-
"Examples" => "examples.md",
17-
"API reference" => "API.md",
18-
])
14+
makedocs(
15+
sitename = "Slim Plotting toolbox",
16+
doctest = false,
17+
clean = true,
18+
authors = "Mathias Louboutin",
19+
pages = Any[
20+
"Home"=>"index.md",
21+
"About"=>"README.md",
22+
"Examples"=>"examples.md",
23+
"API reference"=>"API.md",
24+
],
25+
)
1926

20-
deploydocs(repo="github.com/slimgroup/SlimPlotting.jl")
27+
deploydocs(repo = "github.com/slimgroup/SlimPlotting.jl")

examples/plot_example.jl

Lines changed: 55 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ using SlimPlotting, SegyIO, JLD2
1717
SlimPlotting.PyPlot.close(:all)
1818

1919
#' Path to the files and data used for these examples
20-
data_path = dirname(pathof(SlimPlotting))*"/../data/";
20+
data_path = dirname(pathof(SlimPlotting)) * "/../data/";
2121

2222
#' Read the data
2323
# Pure array
2424
vp = Float32.(segy_read("$(data_path)2dVP.sgy").data);
25-
dm = diff(vp, dims=1);
25+
dm = diff(vp, dims = 1);
2626
shot = Float32.(segy_read("$(data_path)2dshot.segy").data);
2727
xloc = get_header(segy_read("$(data_path)2dshot.segy"), "GroupX")
2828
fslice = JLD2.load("$(data_path)2dfslice.jld");
@@ -32,18 +32,18 @@ fslice = JLD2.load("$(data_path)2dfslice.jld");
3232

3333
# Dummy structures to check plot with metadata
3434
struct geometry
35-
xloc
35+
xloc::Any
3636
end
3737

3838
struct shotrec
39-
data
40-
dt
41-
geometry
39+
data::Any
40+
dt::Any
41+
geometry::Any
4242
end
4343

4444
struct Phys
45-
data
46-
d
45+
data::Any
46+
d::Any
4747
end
4848

4949
## Make physical objects
@@ -58,14 +58,15 @@ shotp = shotrec([shot], 0.008, geometry([xloc]));
5858
#' - The standard matplotlib `Greys` colormap
5959
#' - The perceptually accurate `Greys` colormap from colorcet
6060

61-
figure(figsize=(10, 10))
61+
figure(figsize = (10, 10))
6262
subplot(311)
63-
plot_simage(dmp; new_fig=false, name="Seismic")
63+
plot_simage(dmp; new_fig = false, name = "Seismic")
6464
subplot(312)
65-
plot_simage(dm, (10, 20); cmap="Greys", new_fig=false, name="Greys")
65+
plot_simage(dm, (10, 20); cmap = "Greys", new_fig = false, name = "Greys")
6666
subplot(313)
67-
plot_simage(dm, (10, 20); cmap=:cet_CET_L1, new_fig=false, name="Colorcet Greys")
68-
tight_layout();display(gcf())
67+
plot_simage(dm, (10, 20); cmap = :cet_CET_L1, new_fig = false, name = "Colorcet Greys")
68+
tight_layout();
69+
display(gcf());
6970

7071

7172
#' # Velocity
@@ -74,14 +75,15 @@ tight_layout();display(gcf())
7475
#' - The ColorSchemes `vik` colormap
7576
#' - The perceptually accurate `jet` colormap from colorcet named `cet_rainbow4`
7677

77-
figure(figsize=(10, 10))
78+
figure(figsize = (10, 10))
7879
subplot(311)
79-
plot_velocity(vpp; new_fig=false, name="colorcet jet", cmap="cet_rainbow4")
80+
plot_velocity(vpp; new_fig = false, name = "colorcet jet", cmap = "cet_rainbow4")
8081
subplot(312)
81-
plot_velocity(vp, (10, 20); cmap=:vik, new_fig=false, name="ColorSchemes's vik")
82+
plot_velocity(vp, (10, 20); cmap = :vik, new_fig = false, name = "ColorSchemes's vik")
8283
subplot(313)
83-
plot_velocity(vp, (10, 20); cmap=seiscm(:frequency), new_fig=false, name="Seiscm")
84-
tight_layout();display(gcf())
84+
plot_velocity(vp, (10, 20); cmap = seiscm(:frequency), new_fig = false, name = "Seiscm")
85+
tight_layout();
86+
display(gcf());
8587

8688

8789
#' # Frequency slice
@@ -91,14 +93,15 @@ tight_layout();display(gcf())
9193
#' - The perceptually accurate `bwr` colormap from colorcet named `cet_CET_D1A`
9294

9395
# Frequency slice
94-
figure(figsize=(10, 5))
96+
figure(figsize = (10, 5))
9597
subplot(131)
96-
plot_fslice(fslice["Freq"][1, :, :], (12.5, 12.5); new_fig=false, name="colorcet bwr")
98+
plot_fslice(fslice["Freq"][1, :, :], (12.5, 12.5); new_fig = false, name = "colorcet bwr")
9799
subplot(132)
98-
plot_fslice(fslicep; cmap=:bwr, new_fig=false, name="bwr")
100+
plot_fslice(fslicep; cmap = :bwr, new_fig = false, name = "bwr")
99101
subplot(133)
100-
plot_fslice(fslicep; cmap=seiscm(:bwr), new_fig=false, name="Seiscm bwr")
101-
tight_layout();display(gcf())
102+
plot_fslice(fslicep; cmap = seiscm(:bwr), new_fig = false, name = "Seiscm bwr")
103+
tight_layout();
104+
display(gcf());
102105

103106

104107

@@ -111,14 +114,15 @@ tight_layout();display(gcf())
111114
#' - The perceptually accurate `bwr` colormap from colorcet named `cet_CET_D1A`
112115

113116
# Shot record
114-
figure(figsize=(10, 5))
117+
figure(figsize = (10, 5))
115118
subplot(131)
116-
plot_sdata(shotp; new_fig=false, name="matplotlib seismic", cmap="bwr")
119+
plot_sdata(shotp; new_fig = false, name = "matplotlib seismic", cmap = "bwr")
117120
subplot(132)
118-
plot_sdata(shot, (12.5, 0.008); cmap=:cet_CET_D1A, new_fig=false, name="Colorcet bwr")
121+
plot_sdata(shot, (12.5, 0.008); cmap = :cet_CET_D1A, new_fig = false, name = "Colorcet bwr")
119122
subplot(133)
120-
plot_sdata(shot, (12.5, 0.008); cmap=seiscm(:bwr), new_fig=false, name="Seismic bwr")
121-
tight_layout();display(gcf())
123+
plot_sdata(shot, (12.5, 0.008); cmap = seiscm(:bwr), new_fig = false, name = "Seismic bwr")
124+
tight_layout();
125+
display(gcf());
122126

123127

124128
#' ## Seismic greys
@@ -127,27 +131,41 @@ tight_layout();display(gcf())
127131
#' - The perceptually accurate `greys` colormap from colorcet named `cet_CET_L1`
128132

129133
# Shot record
130-
figure(figsize=(10, 5))
134+
figure(figsize = (10, 5))
131135
subplot(121)
132-
plot_sdata(shotp; new_fig=false, name="colorcet gray", cmap="cet_CET_L1")
136+
plot_sdata(shotp; new_fig = false, name = "colorcet gray", cmap = "cet_CET_L1")
133137
subplot(122)
134-
plot_sdata(shot, (12.5, 0.008); cmap="gray", new_fig=false, name="Greys")
135-
tight_layout();display(gcf())
138+
plot_sdata(shot, (12.5, 0.008); cmap = "gray", new_fig = false, name = "Greys")
139+
tight_layout();
140+
display(gcf());
136141

137142
#' # Compare shot records
138143
#' One of the main visual representation of FWI inversion is to compare the true shot record with the synthetic data from
139144
#' the current velocity model. A good way to visualize this difference is to overlay the two shot records alternating the traces
140145
#' between each shots with a different colormap to check the alignment of the events. We show below how to do this with the
141146
#' `compare_shots` function
142147

143-
figure(figsize=(10, 5))
148+
figure(figsize = (10, 5))
144149
subplot(131)
145-
compare_shots(shotp, shotp; new_fig=false, name="Overlap compare")
150+
compare_shots(shotp, shotp; new_fig = false, name = "Overlap compare")
146151
subplot(132)
147-
compare_shots(shotp, shotp; new_fig=false, cmap=("bwr", "RdBu"), name="Overlap compare custom cmap")
152+
compare_shots(
153+
shotp,
154+
shotp;
155+
new_fig = false,
156+
cmap = ("bwr", "RdBu"),
157+
name = "Overlap compare custom cmap",
158+
)
148159
subplot(133)
149-
compare_shots(shotp, shotp; side_by_side=true, new_fig=false, name="Side by side compare")
150-
tight_layout();display(gcf())
160+
compare_shots(
161+
shotp,
162+
shotp;
163+
side_by_side = true,
164+
new_fig = false,
165+
name = "Side by side compare",
166+
)
167+
tight_layout();
168+
display(gcf());
151169

152170

153171
#' # Wiggle traces

0 commit comments

Comments
 (0)