-
Notifications
You must be signed in to change notification settings - Fork 222
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
Allow passing an array as intensity for plot #1065
Allow passing an array as intensity for plot #1065
Conversation
I haven't reviewed your codes, but please do |
Okay. BTW, I only added a NumPy array support for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one comment for now :)
Okay. BTW, I only added a NumPy array support for
intensity
now to test if it works (it works). More work need to be done (e.g., addtest
).
Yes, time for you to pick up unit testing! I'm currently revamping the plot testing ways at #1036 but you can start first and we'll refactor later. The PyGMT guidelines are at https://github.com/GenericMappingTools/pygmt/blob/v0.3.1/CONTRIBUTING.md#testing-plots, but if you're new to (or need a refresher on) testing, I found https://automationpanda.com/python/ to be a good resource to understand the 'why' and 'how' of testing.
A test with an array intensity is added (9adf272), referring to pygmt/pygmt/tests/test_plot.py Line 264 in 1a2289a
|
Two related questions:
The format of the input file of plot is (-S and -I):
See an example with
|
Yes, please open a new feature request. |
Co-authored-by: Dongdong Tian <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR looks good to me. We will merge this PR if others have no objections.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!
Co-authored-by: Dongdong Tian <[email protected]> Co-authored-by: Wei Ji <[email protected]>
Description of proposed changes
Pass a NumPy array to
intensity
(similar to thex
,y
,size
parameters) for theplot
method when we usex
/y
as the input. (See #891 for details)Currently, we can have two ways to specify an intensity/intensities.
intensity=0.5
, which works for bothx
/y
anddata
input. This is similar to-I0.5
in the GMT command line.intensity=True
, and read intensities from an input file or from a 2D NumPy array, which is only for thedata
parameter. This is similar to-I
in the GMT command line.So, when we want to change the intensities for different points, we can only use the
data
parameter now. This PR tries to pass an array tointensity
so that we can set different intensities when we usex
/y
as point input. This way will not work fordata
input.Related to #891
Reminders
make format
andmake check
to make sure the code follows the style guide.doc/api/index.rst
.Slash Commands
You can write slash commands (
/command
) in the first line of a comment to performspecific operations. Supported slash commands are:
/format
: automatically format and lint the code/test-gmt-dev
: run full tests on the latest GMT development version