Seriestime GMT_part2

hello this is my code

gmt begin series_times pdf,png

gmt set GMT_THEME cookbook


gmt set  FORMAT_DATE_MAP=-o    


gmt set IO_COL_SEPARATOR=tab

gmt info C:\programs\Instance_Sicilia_A.csv

gmt plot C:\programs\Instance_Sicilia_A.csv -i3,4 -Sc0.15c -Gred -R2005-01-01T/2020-01-30T/0.0/6.5  -JX10i   -Bxafg+l"Time" -Byafg+l"Magnitude" -fi3T,2d

gmt end show

i want understand why my points no its align for time label.

this is what i received with this code

and than this is want i want…

in .csv i have
35911 13.3917 38.5727 2012-07-11T10:07:40.96Z 2.9 11.0
long lat time mag depth

The -f option looks suspicious, why is there a 2d there? You do not have any columns in cm or inches as far as I can tell.

1 Like

I increment my code with this

GMT set FORMAT_DATA_IN 2005-01-01T

gmt set FORMAT_DATA_OUT 2005-01-01T

gmt set FORMAT_DATE_MAP=-yyyy

gmt set TIME_EPOCH 2005-01-01T

and in gmt plot i remove +2d…but i dont receive my result…

What’s the problem exactly ?

The only obvious difference between your plot and “this is what I want” is the y-axis limits.


(don’t hesitate to use tools such as deepl to better explain and translate what you really want)


“What I really want” is an example to make you understand.

The code is the reality of my plot.

I want the points to be perfectly aligned as in the plot example.

I honestly don’t understand why they don’t line up…non-aligned is meaningless.

Surely there is something wrong with the code, but I don’t understand what.
I have quoted the first line of the .csv file so you can see how the columns are combined.

Do you mean vertically aligned ?

Your data have time records down to 0.01 seconds (eg. 2012-07-11T10:07:40.96)

What GMT is doing is placing this time coordinate as precisely as resolution allows.

So a point in July 7th and a point the very next day (July 8th) won’t be aligned.

If I understood correctly and you need the points to be aligned, I suggest

  • using a different module (such as histogram)
  • specify the entry to be rounded (everything at July 1st for anything in July for example)

Is it sensible or am I off track ?

aligned as in the second screenshot you see.

In this way I will have a time series that allows me to see in that year what earthquakes, and therefore what magnitude, I had.

Can you try these lines ?

gmt begin series_times png

gmt math C:\programs\Instance_Sicilia_A.csv --FORMAT_CLOCK_OUT=- --FORMAT_DATE_OUT=yyyy-mm = test.txt
gmt plot  test.txt -i3,4 -Sc0.15c -Gred -R2005-01-01T/2020-01-30T/0.0/6.5  -JX10i   -Bxafg+l"Time" -Byafg+l"Magnitude"

gmt end show

First one converts your csv file into text file with rounded timestamps,
Second line is your plot

Uploading: Screenshot (749).png…

I obtain this.
It is the same

I dont change anythings

Well, I have “aligned” them per month. If you want even coarser resolution (aligned per year), just remove mm in --FORMAT_DATE_OUT=yyyy-mm

It’s fantastic.

do you know how I can add the years 2005 or 2007, which don’t appear yet? there seems to be an interval of 2…

-Bxa1Yf1Yg1Y+l"Time" instead of automatic -Bxafg maybe ?

Like I said last time, a controls annotations … without further instruction GMT defines the interval automatically, else it uses your steps (here 1y = annotation every year)
f is for ticks (frame) and g for grid-line

You should play with the tutorial :

Thank you very much.
Yes I know, I should play it more…only then I fail that I try several times…and I ask you to help me out of desperation. I’m new to this world… I’m getting the hang of it little by little.
Thank you for your prompt and sincere help.

1 Like

Same at the beginning of my PhD too :slight_smile:

1 Like

Hi, I wanted to ask you for confirmation…about this line of code which is similar to everything you have seen above.

-Bx15ua1Yfg+l “Time”

in this case, am I telling it to select my data every 15 days making the axis stay with a year to year interval?

Because if I change and put everything with 15u it’s a mess.

I need to have a bigger window, 1 or 2 weeks…for the time series.

As in this example…

You want to “hide” your data ? Or do you want take an average value per 2 weeks window ?

The order for -B parameters is [letter]value. In the code you shared the “15u” is doing nothing … I think.

No I want to represent all the data…the time window must be enlarged.

Instead of having plotted are years… I need a window of 2 weeks and not every year.

The same in the screenshot.

You mean the grid lines ?

-Ba1Yfg2u (or U?)

This will annotate the calendar year (2020, 2021 …)
Use automatic ticks
Put gridlines every 2 weeks.

If you just want to “zoom in”
It’s -R that you need to change (-R2000-01-01T/2000-02-01T would plot only January 2000)

Uploading: Screenshot (751).png…

this is the result.
it very terrible…I had already done this option, but I was not enthusiastic about it because it shows almost everything grey.

isn’t there a way to do what I wrote but not make it like this? But like in the screenshot?

The screenshot uses gridlines every years. There’s nothing apparent about a 2 weeks period.

It’d be simply -Ba1Yf1Yg1Y, and you can change the line style with --MAP_GRID_PEN_PRIMARY=thin,lightgray,dotted for example