Skip to content
Snippets Groups Projects
Commit ce4cd882 authored by podlesny's avatar podlesny
Browse files

now plots colorbar as legend

parent d2ef7386
Branches
Tags
No related merge requests found
...@@ -2,13 +2,13 @@ import numpy as np ...@@ -2,13 +2,13 @@ import numpy as np
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import matplotlib.cm as cm import matplotlib.cm as cm
TANGENTIAL_COORDS = 1 SORT_COORD = 0
def local_to_global(coords, SORT_COORD=0): def local_to_global(coords, SORT_COORD=0):
return coords[:, SORT_COORD].argsort() return coords[:, SORT_COORD].argsort()
def slip_rates(h5file, body_ID, FINAL_TIME, patch=[], interval=[], SORT_COORD=0): def slip_rates(h5file, body_ID, FINAL_TIME, patch=[], interval=[], TANGENTIAL_COORDS=1):
body = 'body' + str(body_ID) # 'frictionalBoundary' 'body' + str(body_ID) body = 'body' + str(body_ID) # 'frictionalBoundary' 'body' + str(body_ID)
coords = np.array(h5file[body + '/coordinates']) coords = np.array(h5file[body + '/coordinates'])
if len(patch) == 0: if len(patch) == 0:
...@@ -37,10 +37,12 @@ def slip_rates(h5file, body_ID, FINAL_TIME, patch=[], interval=[], SORT_COORD=0) ...@@ -37,10 +37,12 @@ def slip_rates(h5file, body_ID, FINAL_TIME, patch=[], interval=[], SORT_COORD=0)
# plot # plot
ax_slip = fig.add_subplot(1, 1, 1) ax_slip = fig.add_subplot(1, 1, 1)
ax_slip.imshow(v_tx, interpolation='nearest', cmap=cm.Greys_r, aspect='auto', origin='lower', extent=[0, patch_size, time[0], time[-1]]) pos = ax_slip.imshow(v_tx, interpolation='nearest', cmap=cm.Greys_r, aspect='auto', origin='lower', extent=[0, patch_size, time[0], time[-1]])
#ax_slip.set_ylim([time[-1], time[0]]) #ax_slip.set_ylim([time[-1], time[0]])
ax_slip.set_ylabel('time [s]') ax_slip.set_ylabel('time [s]')
ax_slip.set_xlabel('horizontal coordinate [m]') ax_slip.set_xlabel('horizontal coordinate [m]')
fig.colorbar(pos, ax=ax_slip)
#ax_slip.set_yscale('log') #ax_slip.set_yscale('log')
# ax_slip.set_ylim([1e-6,1e-2]) # ax_slip.set_ylim([1e-6,1e-2])
#------------------------- #-------------------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment