# Colorbar and earthquake

**URL:** <https://forum.generic-mapping-tools.org/t/colorbar-and-earthquake/3620>\
**Category:** Q&A\
**Created:** [January 20, 2023, 3:26pm UTC](https://forum.generic-mapping-tools.org/t/colorbar-and-earthquake/3620 "2023-01-20T15:26:05Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![annafiglioli](https://avatars.discourse-cdn.com/v4/letter/a/7feea3/32.png) [@annafiglioli](https://forum.generic-mapping-tools.org/u/annafiglioli)\
**Post date:** [January 20, 2023, 3:26pm UTC](https://forum.generic-mapping-tools.org/t/colorbar-and-earthquake/3620/1 "2023-01-20T15:26:05Z")

</div>

Hello everyone,  
this is my code. It doesn’t work, i want to plot my seismicity events change the magnitude with colorbar…but don’t change.  
If i use the column of depth it is work, if i use mag doesn’t work. Obviously in the file txt there isn’t the headers.  
It is very strain.

The header of my file .txt  
Longitude Latitude Day Month Year Hour Minute Second Depth Magnitude  
13.0433 43.9588 10 01 2021 10 37 57 7.8 2.3  
13.3822 43.9247 18 01 2021 14 04 22 7.9 2.2

Thanks you for the answers.

gmt begin italy png

gmt set IO\_COL\_SEPARATOR=tab

gmt set GMT\_THEME cookbook

gmt info C:\programs\sequenza\_marche.txt

gmt coast -R13.00000/13.60000/43.57919/44.2200 -Wthin -B -JM5i -Gbeige -Slightblue -I1

gmt grdimage @earth\_relief\_01s -R13.00000/13.60000/43.57919/44.2200 -I+d

gmt makecpt -T0.9/5.5 -Cjet -N

gmt colorbar -DJCB+ef+w10c/0.2c+h -Bx+llegend -By+lDepth(km) -G0.9/5.5 -I0.25 -Np

gmt plot C:\programs\SHP\ISS330.shp -Wthin,black

gmt plot C:\programs\SHP\DSS330.shp -Wthin,yellow

gmt plot C:\programs\SHP\CSSTOP330.shp -Wthin,green

gmt plot C:\programs\SHP\CSSPLN330.shp -Wthin,coral

gmt plot C:\programs\SHP\SUBDCNT330.shp -Wthin,purple

gmt plot C:\programs\SHP\SUBDZON330.shp -Wthin,gray

gmt plot C:\programs\sequenza\_fino\_a\_18\_gennaio.txt -C -Sci -Wfaint -i0,1,8,9+s0.15

gmt text C:\programs\ancona\_1.txt -F+f18p,Times-Roman,black

gmt text C:\programs\senigallia\_1.txt -F+f18p,Times-Roman,black

gmt plot C:\programs\ancona.txt -Ss0.50 -Wfaint -Gblack

gmt plot C:\programs\senigallia.txt -Ss0.50 -Wfaint -Gblack

gmt image c:\programs\north.jpg -Dg11.50000/38.70000+w0.50 -R11.50000/12.00000/38.70000/39.00000

gmt end show

---

<div class="post-metadata">

**Author:** ![Esteban82](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/esteban82/32/54_2.png) [@Esteban82](https://forum.generic-mapping-tools.org/u/Esteban82)\
**Post date:** [January 20, 2023, 4:13pm UTC](https://forum.generic-mapping-tools.org/t/colorbar-and-earthquake/3620/2 "2023-01-20T16:13:06Z")

</div>

Mm maybe you have to change the values of makecpt to fit the range of mag??

---

<div class="post-metadata">

**Author:** ![annafiglioli](https://avatars.discourse-cdn.com/v4/letter/a/7feea3/32.png) [@annafiglioli](https://forum.generic-mapping-tools.org/u/annafiglioli)\
**Post date:** [January 20, 2023, 4:16pm UTC](https://forum.generic-mapping-tools.org/t/colorbar-and-earthquake/3620/3 "2023-01-20T16:16:21Z")

</div>

i change the parameter…with min/max of values for mag.

gmt plot C:\programs\marche\_se.txt -C -Sci -Wfaint -i0,1,8,9+s0.15 in this line i change the radius for magnitude…but i want share to change the color for mag beynd the radius.

---

<div class="post-metadata">

**Author:** ![Joaquim](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/joaquim/32/16_2.png) [@Joaquim](https://forum.generic-mapping-tools.org/u/Joaquim)\
**Post date:** [January 20, 2023, 4:30pm UTC](https://forum.generic-mapping-tools.org/t/colorbar-and-earthquake/3620/4 "2023-01-20T16:30:48Z")

</div>

Try exchange positions where you’d be asked to tell why a long script doesn’t work.  
Please, provide a Minimal Working Example that can be reproduced.

---

<div class="post-metadata">

**Author:** ![annafiglioli](https://avatars.discourse-cdn.com/v4/letter/a/7feea3/32.png) [@annafiglioli](https://forum.generic-mapping-tools.org/u/annafiglioli)\
**Post date:** [January 21, 2023, 8:22am UTC](https://forum.generic-mapping-tools.org/t/colorbar-and-earthquake/3620/5 "2023-01-21T08:22:33Z")

</div>

![Cattura](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/2X/2/2b6c2aedf5ab5bc0bb01836cb6e641914e530834.jpeg)

this is the example that the script give me for output!

---

<div class="post-metadata">

**Author:** ![PlanetGus](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/planetgus/32/303_2.png) [@PlanetGus](https://forum.generic-mapping-tools.org/u/PlanetGus)\
**Post date:** [January 21, 2023, 11:06pm UTC](https://forum.generic-mapping-tools.org/t/colorbar-and-earthquake/3620/6 "2023-01-21T23:06:59Z")

</div>

Can you try -i0,1,9,8 in column order?

---

<div class="post-metadata">

**Author:** ![PlanetGus](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/planetgus/32/303_2.png) [@PlanetGus](https://forum.generic-mapping-tools.org/u/PlanetGus)\
**Post date:** [January 21, 2023, 11:12pm UTC](https://forum.generic-mapping-tools.org/t/colorbar-and-earthquake/3620/7 "2023-01-21T23:12:38Z")

</div>

> [@annafiglioli](#):
>
> this is the example that the script give me for output

What @Joaquimus asking for is not the picture but a simpler version of your code, without the cosmetic, so one can help you more effectively 🙂

(Your code should be within triple back ticks … see [good practice](https://flint.soest.hawaii.edu/t/forum-tips-tricks-create-a-good-post/2585) )

---

<div class="post-metadata">

**Author:** ![annafiglioli](https://avatars.discourse-cdn.com/v4/letter/a/7feea3/32.png) [@annafiglioli](https://forum.generic-mapping-tools.org/u/annafiglioli)\
**Post date:** [January 22, 2023, 8:51am UTC](https://forum.generic-mapping-tools.org/t/colorbar-and-earthquake/3620/8 "2023-01-22T08:51:42Z")

</div>

no because otherwise I don’t have the variation of the radius with the values of the magnitude.

---

<div class="post-metadata">

**Author:** ![annafiglioli](https://avatars.discourse-cdn.com/v4/letter/a/7feea3/32.png) [@annafiglioli](https://forum.generic-mapping-tools.org/u/annafiglioli)\
**Post date:** [January 22, 2023, 9:21am UTC](https://forum.generic-mapping-tools.org/t/colorbar-and-earthquake/3620/9 "2023-01-22T09:21:46Z")

</div>

[gmt.zip](https://forum.generic-mapping-tools.org/uploads/short-url/w4tYFji6UspOtTMUSzbrdz2U930.zip) (11.7 KB) Uploading: gmt.zip…

---

<div class="post-metadata">

**Author:** ![PlanetGus](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/planetgus/32/303_2.png) [@PlanetGus](https://forum.generic-mapping-tools.org/u/PlanetGus)\
**Post date:** [January 22, 2023, 9:57am UTC](https://forum.generic-mapping-tools.org/t/colorbar-and-earthquake/3620/10 "2023-01-22T09:57:00Z")

</div>

But is it coloured with depth when you invert?

---

<div class="post-metadata">

**Author:** ![Joaquim](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/joaquim/32/16_2.png) [@Joaquim](https://forum.generic-mapping-tools.org/u/Joaquim)\
**Post date:** [January 22, 2023, 12:29pm UTC](https://forum.generic-mapping-tools.org/t/colorbar-and-earthquake/3620/11 "2023-01-22T12:29:05Z")

</div>

Since you want to use the last column for both sizes and colors, it should be `-i0,1,9,9+s0.15`

---

<div class="post-metadata">

**Author:** ![annafiglioli](https://avatars.discourse-cdn.com/v4/letter/a/7feea3/32.png) [@annafiglioli](https://forum.generic-mapping-tools.org/u/annafiglioli)\
**Post date:** [January 22, 2023, 2:16pm UTC](https://forum.generic-mapping-tools.org/t/colorbar-and-earthquake/3620/12 "2023-01-22T14:16:46Z")

</div>

thank you so much now it works perfectly.  
To represent in the legend … this thing or the variation of the radius and color based on the magnitude … how do I create my external input file?  
with the data you see there?

to create an automatic legend there are … but I would like to make it external to make it more organized.

---

<div class="post-metadata">

**Author:** ![annafiglioli](https://avatars.discourse-cdn.com/v4/letter/a/7feea3/32.png) [@annafiglioli](https://forum.generic-mapping-tools.org/u/annafiglioli)\
**Post date:** [January 23, 2023, 8:36am UTC](https://forum.generic-mapping-tools.org/t/colorbar-and-earthquake/3620/13 "2023-01-23T08:36:11Z")

</div>

C:\programs\>gmt legend legend.txt -DjTR+w3c+jTR+o9.25c/-9 -F+gwhite+pthicker  
plot [WARNING]: gmt\_set\_dataset\_verify: Data set has 7 data records but header says it only has 0  
text [WARNING]: gmt\_set\_dataset\_verify: Data set has 1 segments but header says it only has 0

i have this error!  
i don’t[legend.txt|attachment]understand why!  
dont work, my input legend!  
i have an automatic label and i want to build the legend for progressive magnitude.

this is my legend file [legend.txt](https://forum.generic-mapping-tools.org/uploads/short-url/aR3OqCwalonceQ3AA4O2KVMFkjO.txt) (562 Bytes)

thanks for your answers!

---

<div class="post-metadata">

**Author:** ![pwessel](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/pwessel/32/30_2.png) [@pwessel](https://forum.generic-mapping-tools.org/u/pwessel)\
**Post date:** [January 23, 2023, 10:03am UTC](https://forum.generic-mapping-tools.org/t/colorbar-and-earthquake/3620/14 "2023-01-23T10:03:33Z")

</div>

First of all it is a warning and not an error. It is mostly for us developers.  
I assume you are running 6.4 or even 6.5.x?

---

<div class="post-metadata">

**Author:** ![annafiglioli](https://avatars.discourse-cdn.com/v4/letter/a/7feea3/32.png) [@annafiglioli](https://forum.generic-mapping-tools.org/u/annafiglioli)\
**Post date:** [January 23, 2023, 11:13am UTC](https://forum.generic-mapping-tools.org/t/colorbar-and-earthquake/3620/15 "2023-01-23T11:13:54Z")

</div>

ah okay. i use version 6.2

---

<div class="post-metadata">

**Author:** ![pwessel](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/pwessel/32/30_2.png) [@pwessel](https://forum.generic-mapping-tools.org/u/pwessel)\
**Post date:** [January 23, 2023, 12:02pm UTC](https://forum.generic-mapping-tools.org/t/colorbar-and-earthquake/3620/16 "2023-01-23T12:02:39Z")

</div>

Ok, in my 35 years of GMT I don’t think there has ever been a reason to use an older version with bugs compared to a newer version the possibly fixes them plus add new features!

---

<div class="post-metadata">

**Author:** ![annafiglioli](https://avatars.discourse-cdn.com/v4/letter/a/7feea3/32.png) [@annafiglioli](https://forum.generic-mapping-tools.org/u/annafiglioli)\
**Post date:** [January 24, 2023, 12:01pm UTC](https://forum.generic-mapping-tools.org/t/colorbar-and-earthquake/3620/17 "2023-01-24T12:01:12Z")

</div>

ok. i download the last version.

---

<div class="post-metadata">

**Author:** ![annafiglioli](https://avatars.discourse-cdn.com/v4/letter/a/7feea3/32.png) [@annafiglioli](https://forum.generic-mapping-tools.org/u/annafiglioli)\
**Post date:** [January 24, 2023, 12:04pm UTC](https://forum.generic-mapping-tools.org/t/colorbar-and-earthquake/3620/18 "2023-01-24T12:04:30Z")

</div>

i have a new question…I can’t plot with an interval of 4 or 6 well spaced labels in order to better see the labels,

this is a part of code.  
gmt colorbar -DJCB+ef+w10c/0.4c+h+o0/1c -Bxa25D+lTime -By+lday -I0.25

How do I tick off only 4 or 6 dates? clearly legible to each other. for the moment the writings overlap.

thanks you for answers.

---

<div class="post-metadata">

**Author:** ![Joaquim](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/joaquim/32/16_2.png) [@Joaquim](https://forum.generic-mapping-tools.org/u/Joaquim)\
**Post date:** [January 24, 2023, 12:51pm UTC](https://forum.generic-mapping-tools.org/t/colorbar-and-earthquake/3620/19 "2023-01-24T12:51:26Z")

</div>

When we are not satisfied with automatic/regular labels the resort is the custom labels. See the -B manual for custom labels.
