-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample_plots.py
72 lines (55 loc) · 1.75 KB
/
example_plots.py
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
from obspy.core import read
from palplots.visualize import Plot
import matplotlib.pyplot as plt
stream = read('https://ndownloader.figshare.com/files/6994493','H5',apply_calib=True)
# -----------
# wiggle plot
# -----------
# normal use:
# figure will pop up, but you can't manipulate figure
Plot().wiggle(stream,dimension='theta')
# flexible use:
# figure will not pop up, and you can edit the figure via fig and ax
# to show figure, use plt.show()
fig,ax = Plot().wiggle(stream,dimension='theta',show=False)
ax.set_ylim((100,0))
plt.show()
# ------------
# contour plot
# ------------
# normal usage:
# figure will pop up, but you can't manipulate figure
Plot().contour(stream,dimension='theta')
# flexible use:
# figure will not pop up, and you can edit the figure via fig and ax, and cbar
# to show figure, use plt.show()
fig,ax,cbar = Plot().contour(stream,dimension='theta',show=False)
ax.set_ylim((100,0))
cbar.set_clim(-1,1)
plt.show()
# ----------
# fk spectra
# ----------
# normal usage:
# figure will pop up, but you can't manipulate figure
Plot().fk(stream,dimension='theta')
# flexible use:
# figure will not pop up, and you can edit the figure via fig and ax
# to show figure, use plt.show()
fig, ax, stream_fft, dim = Plot().fk(stream,dimension='theta',show=False)
ax.set_ylim((-2,2))
ax.set_title('F-K Spectra')
plt.show()
# ---------
# fk filter
# ---------
# normal usage:
# figure will pop up, but you can't manipulate figure
Plot().fkfilter(stream,dimension='theta',colormap='gray')
# flexible use:
# figure will not pop up, and you can edit the figure via fig and ax
# to show figure, use plt.show()
fig, ax, filtered_stream, H = Plot().fkfilter(stream,dimension='theta',show=False)
ax.set_ylim((50,0))
ax.set_title('Filtered F-K Spectra')
plt.show()