Hello EveryOne
please help me
How to plot focal mechanisme cross section in PyGMT?
my scrip beloow:
import pygmt
import pandas as pd
#Read Data
data = pd.read_csv('data_focmec_mba_ajeng.csv')
#Region
minlon, maxlon = 95,109 #defenisikan batas geografis longitude
minlat, maxlat = -7.0,1#defenisikan batas geografis latitude
region = [minlon,maxlon,minlat,maxlat]
#Plot garis Pantai
fig = pygmt.Figure()
fig.coast(region=region,
projection='M10c',
frame = 'ag',
shorelines='0.25p,black',
land='grey',
water='lightblue')
# #color ramp untuk kedalaman
pygmt.makecpt(cmap="jet", reverse = True,series=[data.depth.min(),data.depth.max()])
#Plot Gempa Bumi berdasarakan Kedalaman
fig.plot(x = data.longitude,
y = data.latitude,
pen ='faint',
style ='c',
color =data.depth,
cmap = True)
#Plot colorbar Kedalaman gempa
fig.colorbar(frame='af+l"Depth (km)"')
#Plot Data Focal Mechanisme
fig.meca(spec='focmec_mba_ajeng.txt',
convention='aki',
scale ='0.3c',
C = True) #panel
#offset = True)
# # Plot Text
fig.plot(x=[100, 105], y=[-5, 0], projection="M", pen=0.5)
fig.text(x=100, y= -5, text="A", font="15,Helvetica")
fig.text(x=105, y= 0, text="B", font="15,Helvetica")
# membuat file cross section
pygmt.project('focmec_mba_ajeng.txt',
unit=True,
center=[100, -5],
endpoint=[105,0],
convention='pz',
width=[-600, 600],
outfile='crossfocmec.dat')
#Plot Cross section
fig.basemap(
projection="X10/-6",
region=[0, 400, 0, 150],
frame=['xafg100+l"Distance"', 'yafg50+l"Depth"', "WSen"],
yshift=-8.5)
fig.plot(data="crossfocmec.dat", projection="X", style="c0.2", pen=1, color="red")
fig.text(x=0, y=0, text="A", font="12,Helvetica")
fig.text(x=1210, y=0, text="B", font="12,Helvetica")
#Convert file ke PNG
fig.savefig ("focmech_ajeng.png", crop=True, dpi=300, transparent=True)