Beachball over map

Dear Obspy Forum.
I have been working with beachball plots and I wanted to plot them over a map for my region.

I followed the steps posted on the example under the web page, unfortunately I am not getting the beachball plotted. However I can plot the epicenters, I use a basemap from ArcGisdatabase (World_Physical_Map).

This is the code:

##this part is for plotting Latitude, Longitude…from a csv file

ax = plt.gca()

min_marker_size = 1.9
for lon, lat, mag, in zip(lons, lats, magni):
x,y = m(lon, lat)
msize = mag * min_marker_size
#eq_map.plot(x, y, ‘b*’, markersize=msize)
m.plot(x, y, ‘r+’, markersize=msize)

i create a list for focal mechanism solutions frmo a csv file

lati,longi =m(lats,lons)
foca=[]
for u in range(len(strike)):
foca.append([strike[u],dip[u],rake[u]])

Trying to plot the beachballs

for k in range(len(foca)):
b=beach(foca[k],xy=(lati[k],longi[k]),facecolor=‘blue’, width=500, linewidth=1,alpha=0.85)
b.set_zorder(10)
ax.add_collection(b)
title_string = “Focal Mechanism Bolivia\n”

plt.title(title_string)
plt.show()

I tried to modify the width and set_order() but i could not get any positive result.
Would you mid give a hand, please?
Thank you in advance.
Tonino

Hey

Maybe switch lat/lon in the X,Y location ?

Thomas

Hi Tonino,

by and large the approach that you have chosen and that is outlined here should work:

In my general experience with basemap one sometimes has to play with the zorder of things, e.g. the depth or layer at which an entity is plotted. If you need more help, please post a fully working, self-contained minimal example that we can run.

All the best,

Lion