Plot focal mechanisms on map

Viewed 89

I am trying to plot focal mechanisms on a map, but it is only the map that comes up. Someone who see what I am doing wrong since the focmecs are not on the map. I don't get any error message.

import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
from obspy.imaging.beachball import beach


plt.figure(figsize=(18,14))

eq_map = Basemap(projection='robin', resolution = 'l', area_thresh = 1000.0, lat_0=0, lon_0=-130)
eq_map.drawcoastlines()
eq_map.drawcountries()
eq_map.fillcontinents(color = 'lightgray')
eq_map.drawmapboundary()
eq_map.drawmeridians(np.arange(0, 360, 30))
eq_map.drawparallels(np.arange(-90, 90, 30))   


lats = [-6.114, -18.0186]
lons = [146.1686, -178.4948]
x,y = eq_map(lons,lats)
focmecs = [[231, 88, 162],[177, 82, 85]]
ax = plt.gca()
for i in range(len(focmecs)):
      b = beach(focmecs[i], xy=(x[i], y[i]), width=1000, linewidth=1)
      b.set_zorder(10)
      ax.add_collection(b)

plt.show()
0 Answers
Related