-
Notifications
You must be signed in to change notification settings - Fork 224
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
Figure.image: Add alias "bitcolor" for "G" #2615
Conversation
@@ -49,6 +50,14 @@ def image(self, imagefile, **kwargs): | |||
[**+p**\ [*pen*]][**+r**\ [*radius*]][**+s**\ [[*dx*/*dy*/][*shade*]]]. | |||
If set to ``True``, draw a rectangular border around the image | |||
using :gmt-term:`MAP_FRAME_PEN`. | |||
bitcolor : str or list |
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.
Is a list allowed?
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.
A list can be used to set both foreground and background colors of 1-bit images:
import pygmt
fig = pygmt.Figure()
for i_G in [
None,
"blue+b",
["blue+b", "red+f"],
]:
fig.image(imagefile="@vader1.png", G=i_G)
fig.shift_origin(xshift="1c")
fig.show()
# fig.savefig(fname="image_Q_list.png")
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.
Ah I see, thanks for the example! So the list would translate to -Gblue+b -Gred+f
. Makes sense.
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.
Exactly! Maybe moving the sentence "Can be repeated with different settings." upwards makes this a bit clearer (please see commit 951a110)?
@GenericMappingTools/pygmt-maintainers I just realized that for |
I think it makes more sense to change |
Yes, I also prefer changing it for |
Description of proposed changes
This PR aims to add the alias
bitcolor
for G of the methodpygmt.Figure.image
.Following the Code Style, no underscore is used (please see https://www.pygmt.org/dev/contributing.html#contributing-code). However, the GMTjl documentation uses an underscore, i.e.,
bit_color
(please see https://www.generic-mapping-tools.org/GMTjl_doc/documentation/modules/image/index.html#imag).Upstream GMT documentation: https://docs.generic-mapping-tools.org/dev/image.html#g
Preview: https://pygmt-dev--2615.org.readthedocs.build/en/2615/api/generated/pygmt.Figure.image.html
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