Restrict the range of seismicity in a cross section

Hi!
I am trying to plot seismicity in a cross section. Actually, I want to reduce the range of the seismicity, for example try to plot it only on the center of the profile. I have done the following:

cat seismicity.txt | project -C$point1[2]/$point1[1] -E$point2[2]/$point2[1] -L-2500/2500 -S -Q -fg -Fpz | psxy -N -Gblack -Sc0.05c -R0/50/100/120 -J -K -O >> $ps

Where -R is the range that I am looking for plotting (between 0 and 50 km of length and between 100 and 120 km of depth) — > -R0/50/100/120

Someone could help me?

I don’t know if I understand correctly. but if the issue is that GMT is plotting all the seismicity wether it falls inside the plotting area or not, then the “-N” flag is the responsible for that.

when you use the “-N” flag, you are telling GMT to NOT clip symbols that fall outside your plot borders

To only plot from 0 to 50 km distance from your origin, instaed of:

do -L0/50 instead.

To only plot between 100 and 120 km depth, I’d insert an:

awk '$2 > 100 && $2 < 120 {print $0}' | before psxy. Which only prints a line, when the second value (depth) is between 100 and 120. Better leave R untocuhed. And, yes, it looks like you do not want -N

That is, all in all:

project seismicty.txt -C$point1[2]/$point1[1] -E$point2[2]/$point2[1] -L0/50 -S -Q -fg -Fpz |
awk '$2 > 100 && $2 < 120 {print $0}' |
psxy -Gblack -Sc0.05c -R -J -K -O >> $ps

If you want to align the seismicity (dots) with the color shaded image, you’d better use the same coordinates (X-latitude in degrees; Y-depth in km). If there is a depth column in seismicity.txt file (say, the 3rd column), use
gmt grdimage … > $ps
cat seismicity.txt | gmt project -C$point1[2]/$point1[1] -E$point2[2]/$point2[1] -fg -Fsz -W-25/25 | awk ‘{if($1>=latmin&&$1<=latmax&&$2>=100&&$2<=200){print $0}}’ | psxy -Gblack -Sc0.05c -R -J -O >> $ps

where latmin/latmax are the latitudes of the starting and ending points of the profile line you want to show.

Thank you!! @wsja