Figure.image: Add alias "bitcolor" for "G"#2615
Conversation
| [**+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.
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.
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.
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
bitcolorfor 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 formatandmake checkto 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