Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
zhen-dong-zhang opened this issue Mar 23, 2021 · 6 comments · Fixed by #1145
Closed

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

zhen-dong-zhang opened this issue Mar 23, 2021 · 6 comments · Fixed by #1145
Assignees
Labels
feature request New feature wanted

Comments

@zhen-dong-zhang
Copy link

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

@zhen-dong-zhang zhen-dong-zhang added the feature request New feature wanted label Mar 23, 2021
@welcome
Copy link

welcome bot commented Mar 23, 2021

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

@weiji14 weiji14 added question Further information is requested and removed feature request New feature wanted labels Mar 23, 2021
@maxrjones
Copy link
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

@zhen-dong-zhang
Copy link
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

@weiji14 weiji14 added feature request New feature wanted and removed question Further information is requested labels Mar 24, 2021
@maxrjones
Copy link
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

@maxrjones maxrjones changed the title Fill positive areas in ploting Fill positive areas in ploting (add GMT wiggle module) Mar 24, 2021
@zhen-dong-zhang
Copy link
Author

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

@core-man
Copy link
Member

core-man commented Mar 26, 2021

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

@core-man core-man self-assigned this Mar 29, 2021
@core-man core-man mentioned this issue Mar 29, 2021
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature wanted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants