-
Notifications
You must be signed in to change notification settings - Fork 213
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
Add Figure.hlines for plotting horizontal lines #923
base: main
Are you sure you want to change the base?
Conversation
As discussed in #670 here's a new module (**hlines**) to plot a single or a set of horizontal lines with only defining the desired y-value(s). For discussion I only add the module for horizontal lines at the moment, however, the adjustments to prepare the same for vertical lines is done very quickly.
@michaelgrund Nice work! I just changed the PR title so that we can focus on one feature |
It's possible to use
but I'm not sure if other features (lines with different colors) are supported. |
Ok will check that and, if possible, adjust the code. |
@GenericMappingTools/pygmt-maintainers This PR has been untouched since August; are we planning to get it wrapped up for v0.5.0? |
I think the issues raised in #923 (review) will be a bit tricky to address, so I suggest v0.6.0. |
@michaelgrund I'm going to bump this back to v0.6.0 |
That's fine @willschlitzer. Totally overlooked the review comments from @meghanrjones. Sorry for that. |
@michaelgrund Are you hoping to get this in to the v0.6 release? |
Unfortunately not @willschlitzer ... Hope I can continue working on this PR end of February/beginning of March. Set the milestone to v0.7.0. |
@michaelgrund I think we should get this feature done in v0.13.0. Are you still interested in working on this PR? |
Yes I am, after 3 years we should definitely bring this in v0.13.0. |
with Session() as lib: | ||
# get limits from current map boundings if not given | ||
# via xmin, xmax | ||
x = np.array([[lib.extract_region()[0]], [lib.extract_region()[1]]]) | ||
x = np.repeat(x, list_length, axis=1) |
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.
Use the Figure.region
property (https://www.pygmt.org/dev/api/generated/pygmt.Figure.html#pygmt-figure):
with Session() as lib: | |
# get limits from current map boundings if not given | |
# via xmin, xmax | |
x = np.array([[lib.extract_region()[0]], [lib.extract_region()[1]]]) | |
x = np.repeat(x, list_length, axis=1) | |
# get limits from current map boundings if not given via xmin, xmax | |
xmin, xmax = fig.region[0:2] | |
x = np.repeat([[xmin], [xmax]], list_length, axis=1) |
As discussed in #670 here's a new module (hlines) to plot a single or a set of horizontal lines with only defining the desired y-value(s). For discussion I only add the module for horizontal lines at the moment, however, the adjustments to prepare the same for vertical lines is done very quickly. Furthermore, currently the whole procedure is performed in a loop since it's not possible to pass multi-segment lines to the plot function so far (except using an input file). Please correct me if I'm wrong.
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