Changing global gmt.conf

(On Linux)

I seem to remember that before, there was a global gmt.conf, somewhere on the filesystem, that you could make changes to, and the changes would be reflected in all gmt plots created.

This seems to not be the case anymore. So, if I want to, say, have GMT_THEME=minimal as default, and applied to all plots, where would I put this?

gmtset

How do I set a global parameter with gmtset? And where is the gmt.conf stored?

gmtset -Gdefaultsfile refers to system defaults; is that supposed to refer to a gmt.conf?

Gmt first looks in the current directory, then home directory, for a gmt.conf file. So a local file will override it but if you have nothing in the local directory then the home directory one should be read.

And do I remember correctly that there used to be a global gmt.conf file that was placed in /etc or some other kind of system directory?

Nope.

Thanks Joaquim and Paul!

If I don’t want to:

  • execute gmt set every single time, for every plot to get a gmt.conf in the local dir (which I very frequently do) and
  • do not want a gmt.conf laying around in my home directory

What are my alternatives?
I could see a use in being able to define e.g. an environment variable, GMT_CONF, where one could store the path to a gmt.conf that is customized. Then I can store my gmt.conf in some kind of .dotfolder, hidden from view.

Your alternative is to use the on line --PARAMETER mechanism. That’s what I always do.

Actually, that is what I often do as well, in addition to gmt set.

What about

  • also accepting .gmt.conf (i.e. invisible dotfile, as opposed to gmt.conf) in $HOME? Having a visible file in ~ that will be machine read 99.9% of the time is too intrusive in my opinion, and/or
  • create an environment variable, as mentioned above?

Honestly, I don’t see what’s the problem of gmt.conf being visible. On Windows all .somthing are visible files.

My reasons:

  • It litters an important directory (that often contains way too much stuff as it is). Kepp it tidy.
  • It’s a file that you would (ideally) want to touch as rarely as possible (in my case; basically once, after and during system set up).
  • On Unix and Linux, dotfiles are hidden, so my simplest (and best) response would be; why should they be visible.

So that people know they have one when things start to go wrong and blame that GMT is not working well?

https://www.google.com/search?client=firefox-b-d&q=cluttered+home+directory

You can also put your gmt.conf in the GMT user directory ~/.gmt where it is hidden with all the other junk. Perhaps that is better. In modern mode each session will be initiated with those settings unless you pass -C to gmt begin.

1 Like

Thanks Paul. Having gmt.conf in ~/.gmt is Ok!

Having some trouble doing this.
See script below with comments

# do this in ~
cd ~

# make gmt.conf in ~/.gmt with GMT_THEME=minimal
gmt defaults | sed 's/classic/minimal/g' > ~/.gmt/gmt.conf

# gmt defaults now reads ~/.gmt/gmt.conf since GMT_THEME is set to minimal
gmt defaults | grep minimal
GMT_THEME                      = minimal

# I expect a minimal themed plot, but getting classic
gmt pscoast -RNO -W -Bxafg -Byafg -B+t"Title"+s"Subtitle" -JM10c -png gmt-conf-test

One-liners may work different. Try a modern or classic mode script.

Better, but now run into an issue that the frame is classic (but text seems to be is correct with minimal-theme font);

# do this in ~
cd ~

# make gmt.conf in ~/.gmt with GMT_THEME=minimal
gmt defaults | sed 's/classic/minimal/g' > ~/.gmt/gmt.conf

# gmt defaults now reads ~/.gmt/gmt.conf since GMT_THEME is set to minimal
gmt defaults | grep minimal

# I expect a minimal themed plot, but getting classic
gmt begin gmt-conf-test png
gmt pscoast -RNO -W -Bxafg -Byafg -B+t"Title"+s"Subtitle" -JM10c
gmt end show

I get some warnings during this run:

gmt [WARNING]: GMT_COMPATIBILITY: Expects values from 6 to 6; reset to 6.
gmt [WARNING]: GMT_COMPATIBILITY: Expects values from 6 to 6; reset to 6.

But can’t see what would trigger this.

And why would one-liners not use ~/.gmt/gmt.conf?

Did not say it should not use it - just that it may work differently for now.