# Plot diagram Lat, Long or MAG depth

Hello everyone,
Im new in this platform. I try to plot a diagram where i can see the distribution of my earthquake for lat and long or mag and depth.
I use this code, but the plot there are but no the data.
pdf,png.pdf (6.9 KB)

gmt begin pdf,png
gmt makecpt -Cred
gmt psxy lat_long.txt -R14.20/15.20/37.40/38.20 -JX15c/10c -Sp0.35c -Gred -Baf
gmt plot lat_long.txt -i1,2 -R14.20/15.20/37.40/38.20 -JX15c/10c -Sp0.35c -Gred -Baf
gmt end show

I want to visualize this

For example.

Itâ€™s difficult to help when you donâ€™t include any of the data.
But, just by looking at your `-R` itâ€™s clear that this plot is not going to show much.

Your `-R` should plot earthquakes with magnitudes from 14.20 to 15.20 on the x-axis (which is very severeâ€¦) and from 37.70 and 38.20 km depth on the y-axis.

Remember the `-R`-syntax: `-Rxmin/xmax/ymin/ymax` (or use `-R+r`).

A correct `-R` for your example figure would be something like

``````-R2/9/-250/750
``````

I donâ€™t think itâ€™s necessary to plot negative depths (if Z is positive downwards).
Earthquakes way out in space is not very common!

Hello andreas,
this is one part of my .txt

14,999 37,684
14,971 37,673
14,996 37,682
14,96 37,676
14,985 37,69
14,968 37,678
14,98 37,699
14,979 37,677
15,002 37,683
14,99 37,679
14,97 37,683
14,979 37,692
14,98 37,687
14,993 37,683
14,986 37,7
14,983 37,675
15,002 37,68
14,946 37,672
14,943 37,665
14,975 37,671
14,999 37,692
14,969 37,663
14,99 37,677
14,944 37,666
14,994 37,695
14,973 37,669
14,974 37,674

LON and LAT.

Infact the -R is referring on LON and LAT no for mag and depth.
In my region donâ€™t have more magnitude i have a range 1.2 to 4 and for depth 10 to 19 km.

So what is wrong?

So itâ€™s basically a plot of quakes where lon is on the x-axis and lat is on the y-axis? How do you want to represent the magnitude and/or depth?

Yes, sure.
Basically I wanted to make two graphs one for lat and long and one for depth and mag.
But my biggest problem is that it doesnâ€™t plot anything whether I use lat long data or mag depth data.
I would like a simple chart as I showed in the first post.

I would like to create some basic scripts for the moment and then go and complicate things, precisely because I am at the very beginning.

Also try to replace , with . as decimal delimiter.

Here is a small exmaple of the lon lat plot.

I need to replace `,` with `.` as decimal delimiter.

``````gmt plot -Sc0.1c -R14.9/15.1/37.6/37.7 -JX10c -Bxafg+l"Long" -Byafg+l"Lat" -pdf test data
``````

gmt begin test_data pdf,png

gmt plot lat_long.txt -Sc0.1c -R14.9/15.1/37.6/37.7 -JX10c -Bxafg+l"Long" -Byafg+l"Lat"

gmt end show

Donâ€™t change anythings.

I change , to .
you can see:

|14.999|37.684||||
|14.971|37.673||||
|14.996|37.682||||
|14.96|37.676||||
|14.985|37.69||||
|14.968|37.678||||
|14.98|37.699||||
|14.979|37.677||||
|15.002|37.683||||
|14.99|37.679||||
|14.97|37.683||||
|14.979|37.692||||
|14.98|37.687||||
|14.993|37.683||||
|14.986|37.7||||
|14.983|37.675||||
|15.002|37.68||||
|14.946|37.672||||
|14.943|37.665||||
|14.975|37.671||||
|14.999|37.692||||
|14.969|37.663||||
|14.99|37.677||||
|14.944|37.666||||
|14.994|37.695||||
|14.973|37.669||||
|14.974|37.674||||
But i dont have plot point.

Why? You ok and me no.

Can you run to see how GMT is reading that file?? Please copy the info that you get.

g`mt info lat_long.txt`

gmt info lat_long.txt
gmtinfo [ERROR]: No input data found!

this is the error that software give me when i put gmtinfo before the plotâ€¦

This could because

• The name (and extension) is not exactly the same.
The file is not in the same folder than the script.

Could you run `ls` (to see the list of files that you have in the folder)?

I put two screenshotâ€¦one where there is my .txt file
anothere there is .bat file.

I share with you the last GMT workshop (from July). I think that it might help.

Thanks. I think that is the file is in the Cache file, GMT should found it. But, just to be sure, try to put the script and file in the same folder.

Also, I would recommend you to use bash files (instead of DOS bat).

`gmt` doesnt handle `|` as column separator. Thatâ€™s why you get the `gmtinfo [ERROR]: No input data found!` error.

Try using `tab`, space or comma (`,`) instead. See https://docs.generic-mapping-tools.org/latest/gmt.conf.html#term-IO_COL_SEPARATOR.

Yes, Andreas solution should work.

gmt begin test_data pdf,png

gmt info lat_long.txt --IO_COL_SEPARATOR=space

gmt plot lat_long.txt -Sc0.1c -R14.9/15.1/37.6/37.7 -JX10c -Bxafg+l"Long" -Byafg+l"Lat"

gmt end show

Thanks to all to help me very much.

I think that the write script is wrong probably.
Where i put IO_COL_SEPARATOR?

Try with that file:

Anna.txt (368 Bytes)

``````gmt info Anna.txt
Anna.txt: N = 27	<14.943/15.002>	<37.663/37.7>``````

C:\Users\Anna>gmt info C:\programs\Anna.txt
C:\programs\Anna.txt: N = 27 <14.943/15.002> <37.663/37.7>

C:\Users\Anna>gmt plot Anna.txt -Sc0.1c -R14.943/15.002/37.663/37.7 -JX10c -Bxafg+l"Long" -Byafg+l"Lat"
plot [ERROR]: Cannot find file Anna.txt

C:\Users\Anna>gmt end show
PS C:\Users\Anna>

Yes, finally stamp N=â€¦
but i have problem in plot!!