Skip to content

Fill positive areas in ploting (add GMT wiggle module) #1114

Closed

Description

@zhen-dong-zhang

Hi,
I'm new to pygmt and wondering how to fill the positive areas in plotting?
Please find the figure below for more information:
fill
Thanks for your attention.
Best Regards,
Zhendong

Activity

  1. welcome commented on Mar 23, 2021

    @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.

  2. added
    question
    and removed
    feature request
    on Mar 23, 2021
  3. maxrjones commented on Mar 24, 2021

    @maxrjones
    Member

    It's not included in PyGMT yet but your request sounds similar to GMT's wiggle module. Can you take a look at the documentation for wiggle and let us know if this suites your request? If so, we can convert this into a feature request for a wiggle method in PyGMT. Here's the output from an example in the GMT docs:

    wiggle

  4. zhen-dong-zhang commented on Mar 24, 2021

    @zhen-dong-zhang
    Author

    Hi Meghan,
    Thanks a lot for your reply.
    Yes, it is wiggle plotting, which is very popular in exploration geophysics.
    I have implemented it by using matplot. But it would be helpful if pygmt can have this function.
    Best Regards,
    Zhendong

  5. added
    feature request
    and removed
    question
    on Mar 24, 2021
  6. maxrjones commented on Mar 24, 2021

    @maxrjones
    Member

    Hi Zhendong,
    I am glad you found a way to make the plot and agree that this would be a nice function to have in PyGMT! We'll keep the issue open and I will add the GMT module name to the title of your GitHub issue so that developers can find it easier to work on.
    Best regards,
    Meghan

  7. changed the title [-]Fill positive areas in ploting[/-] [+]Fill positive areas in ploting (add GMT wiggle module)[/+] on Mar 24, 2021
  8. zhen-dong-zhang commented on Mar 24, 2021

    @zhen-dong-zhang
    Author

    Hi Meghan,
    Thank you for taking the time and effort in adding the module.
    I'm looking forward to it.
    Best Regards,
    Zhendong

  9. core-man commented on Mar 26, 2021

    @core-man
    Member

    @zhen-dong-zhang you could still use wiggle in PyGMT even though we have wrapped it. See an example below modified from Examples

    GMT command line:

    gmt math -T-8/6/0.01 -N3/0 -C2 T 3 DIV 2 POW NEG EXP T PI 2 MUL MUL COS MUL 50 MUL = | gmt wiggle -R-10/10/-1/1 -JX15c -BWSne -Bxa2f1 -Bya0.5 -Z10c -DjRM+w100+lnT -T0.5p -Gred+p+n -W0.5p -pdf map
    

    PyGMT call_module method:

    import pygmt
    from pygmt.clib import Session
    import numpy as np
    
    # Create (x, y, z) which is equal to the gmt math above
    x = np.arange(-8, 7, 0.1)
    y = np.zeros(x.size)
    z = 50 * np.exp(-(x/3)**2) * np.cos(2*np.pi*x)
    
    fig = pygmt.Figure()
    fig.basemap(region=[-10, 10, -1, 1], projection="X15c", frame=["WSne", "xa2f1", "ya0.5"])
    with pygmt.helpers.GMTTempFile() as temp_file:
        np.savetxt(temp_file.name, np.column_stack((x, y, z)))
        with Session() as session:
            session.call_module("wiggle", "{} -Z10c -DjRM+w100+lnT -T0.5p -Gred+p+n -W0.5p".format(temp_file.name))
    fig.show()


    BTW, I am going to wrap wiggle next week if no other contributors try it during these 2-3 days.

  10. self-assigned this
    on Mar 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

feature request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions