Skip to content

Is that possible to fill the space between the contour lines using hachure patterns? Or use them in grdimage? #3259

Open

Description

@phalucy

Description of the desired feature

In many geo-related fields, we need to plot spatial distributions of composite values or trends together with their significant levels.
Many papers have those kinds of maps by showing the levels with dots/hatchure patterns.
However, I don't know there is a way to reproduce those figures with hatched significant fields in GMT.
Is there any way to plot some patterns/dots/lines over the significant values?

One potential way may be creating a grd file by replacing insignificant values with NaNs. Then, I could use grdimage to plot it using cmap, which contains hachure patterns instead of normal colors. But for now, I don't know how to do so, because hacure patterns only works when 'fill' or '-G' function is available.

By the way, the GMT example 16 (https://docs.generic-mapping-tools.org/dev/gallery/ex16.html) showed a way to use hatched cpt and grdview, but it is not 'elegent' way because we need to edit the cpt file manually. I think it could be possible to include such function inside the codes of GMT/PyGMT.

Are you willing to help implement and maintain this feature?

No

Activity

  1. added
    feature request
    on May 18, 2024
  2. welcome commented on May 18, 2024

    @welcome

    👋 Thanks for opening your first issue here! Please make sure you filled out the template with as much detail as possible. You might also want to take a look at our contributing guidelines and code of conduct.

  3. changed the title [-]Is that possible to fill hachure patterns between the contour lines? Or use them in grdimage?[/-] [+]Is that possible to fill between the contour lines using hachure patterns? Or use them in grdimage?[/+] on May 18, 2024
  4. changed the title [-]Is that possible to fill between the contour lines using hachure patterns? Or use them in grdimage?[/-] [+]Is that possible to fill the space between the contour lines using hachure patterns? Or use them in grdimage?[/+] on May 18, 2024
  5. seisman commented on May 19, 2024

    @seisman
    Member

    Many papers have those kinds of maps by showing the levels with dots/hatchure patterns.

    Can you please show some examples so that we can understand the feature request better?

  6. phalucy commented on May 19, 2024

    @phalucy
    Author

    Many papers have those kinds of maps by showing the levels with dots/hatchure patterns.

    Can you please show some examples so that we can understand the feature request better?

    Hi, thanks for reply.

    Please find the example figures in the following paper: https://www.nature.com/articles/s41467-022-31676-8 (see Figs. 1-3)
    I think the hatching patterns in those figures may be done by contourf function in matplotlib (https://matplotlib.org/stable/gallery/images_contours_and_fields/contourf_hatching.html) or contour effects in NCL (https://www.ncl.ucar.edu/Applications/coneff.shtml; see the example [coneff_13.ncl]).

  7. seisman commented on May 20, 2024

    @seisman
    Member

    It seems a nice feature but may be not easy to implement.

  8. yvonnefroehlich commented on May 21, 2024

    @yvonnefroehlich
    Member

    Maybe a first step would be to allow patterns when setting up a custom colormap. Probably, this is something that has to be implemented directly in GMT.

    import pygmt
    
    # -----------------------------------------------------------------------------
    # (I) cmap with colors - allowed
    fig = pygmt.Figure()
    fig.basemap(region=[-5, 5, -1, 1], projection="X10c/2c", frame=0)
    
    pygmt.makecpt(cmap="lightorange,orange,red,darkred", series=[0, 4, 1])
    fig.colorbar(cmap=True, position="jMC+h", frame=True)
    
    fig.show()
    
    # %%
    # -----------------------------------------------------------------------------
    # (II) cmap with pattern - not available
    # GMTCLibError: Module 'makecpt' failed with status code 8:
    # makecpt [ERROR]: Badly formatted color entry: +p8
    
    fig = pygmt.Figure()
    fig.basemap(region=[-5, 5, -1, 1], projection="X10c/2c", frame=0)
    
    pygmt.makecpt(cmap="p8,p17,p15,p25", series=[0, 4, 1])
    fig.colorbar(cmap=True, position="jMC+h", frame=True)
    
    fig.show()
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

    feature request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions