Skip to content

Figure.timestamp: Plot GMT timestamp logo #3646

@seisman

Description

@seisman

The Figure.timestamp method is a high-level wrapper for GMT's common option -U. With this method, we should disallow -U option in all plotting method.

The syntax of -U

The full syntax of the -U option is:

-U[<label>][+c][+t<text>][+j<just>][+o<dx>[/<dy>]]

There are four GMT defaults that can affect the timestamp logo.

  • MAP_LOGO: controls if a timestamp logo should be plotted [Not implmented since it makes no sense here]
  • MAP_LOGO_POS: defaults to BL/-54p/-54p. It's equivalent to setting the +j and +o modifiers. [Already implmented]
  • FONT_LOGO can control the font ID of the text strings. It's implemented by passing --FONT_LOGO=xxx to the GMT C API. [Add Figure.timestamp to plot the GMT timestamp logo #2208]
  • FORMAT_TIME_STAMP can control the format of the timestamp. It's implemented by passing --FORMAT_TIME_STAMP to the GMT C API. [Add Figure.timestamp to plot the GMT timestamp logo #2208]

Function signature

timestamp(
    text=None, 
    label=None, 
    justify="BL", 
    offset=("-54p", "-54p"), 
    font="Helvetica,black", 
    timefmt="%Y %b %d %H:%M:%S"
)

Implementation notes

  1. The method is implemented by calling gmt plot -T -U...
  2. An upstream bug of the +o modifier for GMT <=6.4.0 (-U doesn't work with a single offset value gmt#7107).
  3. For GMT<=6.4.0, FONT_LOGO can only change the font ID, but since GMT 6.5.0, it can also change both the font ID and color (but not the font size). See Allow FONT_LOGO to change font color gmt#7125
  4. In GMT 6.5.0, a new modifier +t will be added. See Allow FONT_LOGO to change font color gmt#7125.

Issues to track

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Ongoing maintenance

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions