-
Notifications
You must be signed in to change notification settings - Fork 226
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
Wrap colorbar #332
Wrap colorbar #332
Conversation
Initial commit for wrapping the colorbar function raised first at #109 but also #231, to be implemented under base_plotting.py alongside the other mapping related stuff. Original GMT `colorbar` documentation can be found at https://docs.generic-mapping-tools.org/latest/colorbar.html. Storing sample test cases under test_colorbar.py. Current implementation has an alias for position (D) which is arguably the most important one. and the one we've focused writing the tests for. Also wrapped around common aliases region (R), projection (J), frame (B) and cmap (C).
Including tests for controlling how the border around the color scalebar is styled.
Included one test for checking the truncation works to a min/max range. Also made sure region (R) is parsed as a slash separated sequence string.
Include one test for 0.1x scale. Also added docs for truncate (G) that was missing in the last commit.
Created a gallery example for `colorbar` illustrating some scientific colourmaps and ways of positioning the colorbar inside the map frame. Changed title of this gallery section to be a more generic "Plotting map items". Also corrected lat/lon to lon/lat in the docstring of one of the tests.
Alright, |
5b3a53a
to
8a8562d
Compare
@liamtoney, do you mind reviewing this |
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.
Looks good to me! Thorough tests — nice.
cmap="oleron", | ||
position="jTC+w6c/1c+h", # justified inside map frame (j) at Top Center (TC) | ||
box=True, | ||
frame=["+Loleron", "xaf", "y+lm"], |
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.
Have we documented how the argument
frame=["+Loleron", "xaf", "y+lm"]
is equivalent to
-B+Loleron -Bxaf -By+lm
(i.e. use a list to replicate repeated flags) somewhere? I think it could be a good item to add to the Note for experienced GMT users in the docs and can do so if desired.
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.
Funny you said that, I only discovered that recently too at #325 (comment) but didn't know where best to put it in the docs.
I think it could be a good item to add to the Note for experienced GMT users in the docs and can do so if desired.
Yep, go for it!
Cheers for reviewing this @liamtoney! I'll take a look at your legend gallery example next. There might be some merge conflicts with this PR. |
Wrapping the
colorbar
function!See also Julia implementation at https://www.generic-mapping-tools.org/GMT.jl/latest/#GMT.colorbar.
Description of proposed changes
Example code:
Parameters/Aliases to wrap:
...
Fixes #109, part of #231
Reminders
make format
andmake check
to make sure the code follows the style guide.doc/api/index.rst
.