forked from navjotk/error_propagation
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_field.py
More file actions
35 lines (23 loc) · 699 Bytes
/
plot_field.py
File metadata and controls
35 lines (23 loc) · 699 Bytes
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
import h5py
from util import plot_field
import numpy as np
import matplotlib.pyplot as plt
filename = "overthrust_2D_initial_model.h5"
f = h5py.File(filename, 'r')
datakey = 'm0'
data_m = f[datakey][()]
data = data_m
shape = data.shape
vmax = np.max(data)
im = plt.imshow(data, vmax=vmax, vmin=0, cmap="GnBu",
extent=[0, 20, 0.001*(shape[-1]-1)*25, 0])
plt.xlabel("X (km)")
plt.ylabel("Depth (km)")
cb = plt.colorbar(shrink=.3, pad=.01, aspect=10)
for i in cb.ax.yaxis.get_ticklabels():
i.set_fontsize(12)
cb.set_label('Pressure')
# plt.savefig(output_file, bbox_inches='tight')
plt.show()
plt.clf()
plot_field(np.transpose(data_m), output_file='test_field.pdf')