Skip to content

Support underlays in modern more #4990

Closed

Description

@maxrjones

Description of the desired feature

Add the functionality to recycle bits of PostScript in modern mode, e.g., make a common underlay base.ps and use it in different plots. I'm most interested in the basemap use case, but there also may be people who are interested in being able to add common overlays to many plots.

A pseudo-code example:

export GMT_SESSION_NAME=underlay
gmt begin
gmt basemap -JM6i -R-30/30/-30/30 -Bafg

unset GMT_SESSION_NAME

gmt begin -Dunderlay,overlay # duplicate underlay session to overlay
gmt plot ex1.txt -S -Cchrome
gmt end show

gmt begin -Dunderlay,overlay # duplicate underlay session to overlay
gmt plot ex2.txt -S -Cchrome
gmt end show

gmt begin -Dunderlay,overlay # duplicate underlay session to overlay
gmt plot ex3.txt -S -Cchrome
gmt end show

Are you willing to help implement and maintain this feature? Yes/No

Activity

  1. PaulWessel commented on Mar 18, 2021

    @PaulWessel
    Contributor

    Some of you may recall an early modern mode command called revert (revert.c now lives in exile in the sandbox just in case). It could strip off layers from the current plot. It seems a bit clutzy to me thought.

    Here are quick thoughts on overlays/underlays

    1. Plot what you consider a layer normally
    2. Run gmt layer get name to make a named snapshot of current plot
    3. When you want to add this layer to another plot, run gmt layer put name
    4. To use it as an underlay (first layer) for a new figure, you just do gmt figure first then gmt layer put name
    5. Layers are not tied to a figure, but tied to session, and may be used any number of times
    6. Named layers die when the session ends

    The verbs get and put can be discussed. We can discuss if calling get with the same name as before simply overwrites or if we refuse to do so without some -F force option or an intermediate gmt layer delete name command.

  2. maxrjones commented on Mar 19, 2021

    @maxrjones
    MemberAuthor

    Some of you may recall an early modern mode command called revert (revert.c now lives in exile in the sandbox just in case). It could strip off layers from the current plot. It seems a bit clutzy to me thought.

    Here are quick thoughts on overlays/underlays

    1. Plot what you consider a layer normally
    
    2. Run **gmt layer get** _name_ to make a named snapshot of current plot
    
    3. When you want to add this layer to another plot, run **gmt layer put** _name_
    
    4. To use it as an underlay (first layer) for a new figure, you just do **gmt figure** first then **gmt layer put** _name_
    
    5. Layers are not tied to a figure, but tied to session, and may be used any number of times
    
    6. Named layers die when the session ends
    

    The verbs get and put can be discussed. We can discuss if calling get with the same name as before simply overwrites or if we refuse to do so without some -F force option or an intermediate gmt layer delete name command.

    Given that the layers die when the session ends, it is not clear to me how you would finalize the figures without closing the session if, for example, you want to use the same layers when updating a plot every day, week, year, etc.

  3. PaulWessel commented on Mar 19, 2021

    @PaulWessel
    Contributor

    Perhaps we should convert this to a discussion item?

  4. locked and limited conversation to collaborators on Mar 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions