How to use -R and -J

Hi I have a question on how to use -R and -J to use default values to graph. I cant find the answer in the documentation so Im a bit confused. I need to make basic GMT code that will plot any XYZ into a simple elevation contour plot. However, this wouldn’t work with specific -R or -J data. Is there a way to structure them so that regardless of the input XYZ, the output would be a simple chart. (for example, R would just take the region that the coordinates are in).

-R defines your area of interest. It can be cartesian (x,y), geographic (lon,lat), or a mixture.
For example :

-R50/60/2012-01-01/2013-12-31

Will plot a domain from 50 to 60 in abscisses and from 2012 to 2014 in ordinates.

GMT doesn’t necessarily know the nature of your data. Here it will most likely assume that abscisses are longitudes and ordinates absolute times. This can be specified in -J.

-J defines how your data will be projected. (-Jm = mercator , -Jg = globe , -Jx = cartesian …)

In the example above, I have a mixture of longitude and time, so any geographic projection would be weird (I don’t have latitude) => cartesian -Jx.

-JX10cd/5cT

Will create a plot :

  • 10cm wide (10c) with values in longitudinal degrees (d)
  • 5cm height (5c) with values in absolute time (T)

I encourage you to look at some examples in the doc to have a better sense on how it works :wink:

Regarding the “automatic” process. You can always try to find min/max values and parse them as arguments. If you use shell :

-R${minx}/${maxx}/${miny}/${maxy} -JX10c  #plot 10x10cm

How you find min/max .xy depends on your data.