Skip to content

Commit 902ccfd

Browse files
committed
Minor improvements to CCP plots
1 parent 36d8f7c commit 902ccfd

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

seismic/receiver_fn/rf_ccp_util.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -812,6 +812,7 @@ def plot(self, ax, amp_min=-0.2, amp_max=0.2, gax=None, hk=None, gravity=None):
812812
levels=np.linspace(amp_min, amp_max, 100),
813813
extend='both')
814814
ax.invert_yaxis()
815+
legendCreated = False
815816
for k in self._g_meta.keys():
816817
px = self._g_meta[k]['distance_along_profile']
817818
pd = self._g_meta[k]['distance_from_profile']
@@ -823,12 +824,22 @@ def plot(self, ax, amp_min=-0.2, amp_max=0.2, gax=None, hk=None, gravity=None):
823824

824825
# plot estimates from hk results
825826
if(hk is not None):
827+
markers = [{'marker':'o', 's':100, 'facecolors':'yellow', 'edgecolors':'k', 'lw':1},
828+
{'marker':'v', 's':100, 'facecolors':'green', 'edgecolors':'k', 'lw':1},
829+
{'marker':'s', 's':100, 'facecolors':'magenta', 'edgecolors':'k', 'lw':1}]
830+
keys = ['H0', 'H1', 'H2']
826831
if(k in list(hk['Station'])):
827832
idx = np.where(k == hk['Station'])[0][0]
828-
hlist = [hk.iloc[idx][key] for key in ['H0', 'H1', 'H2']]
829-
hlist = [item for item in hlist if not np.isnan(item)]
833+
hlist = [hk.iloc[idx][key] for key in keys]
830834

831-
for h in hlist: ax.scatter(px, h, marker='x', c='k')
835+
for i, h in enumerate(hlist):
836+
m = markers[i]
837+
if(not np.isnan(h)): ax.scatter(px, h, label=keys[i], **m)
838+
# end for
839+
if(not legendCreated):
840+
ax.legend(ncol=3, fontsize='small', loc='lower right')
841+
legendCreated = True
842+
# end if
832843
# end if
833844
# end if
834845
# end for

0 commit comments

Comments
 (0)