How to plot a binary mask (xarray.Dataset) using pygmt.grdimage (1: Color and 0: Transparent)"

Thanks for the solution. But I met the following errors when I tried your code ‘nan_transparent’.
It seems the -Q+z0 did not work. If I delete it, the code runs well.
Would you mind helping me this issue?

-----------Error

grdimage [ERROR]: Option -Q parsing failure.  Correct syntax:

-Q<color>
Specify <color> as one of:
• <gray> or <red>/<green>/<blue>, all in range 0-255;
• <cyan>/<magenta>/<yellow>/<black> in range 0-100%;
• <hue>-<saturation>-<value> in ranges 0-360, 0-1, 0-1;
• Any valid color name.
For PDF fill transparency, append @<transparency> in the range 0-100% [0 = opaque].
---------------------------------------------------------------------------
GMTCLibError                              Traceback (most recent call last)
Cell In[18], line 22
     17 # Set up colormap with two desired colors for the values 0 and 1
     18 pygmt.makecpt(
     19     series=[0, 2, 1],
     20     cmap="black,green",
     21 )
---> 22 fig.grdimage(
     23     grid=dataset.data,
     24     projection='X20c',
     25     nan_transparent="+z0",  # Make grid nodes which are zero transparent
     26     cmap=True,
     27 )
     28 fig.show()

File e:\miniconda3\lib\site-packages\pygmt\helpers\decorators.py:594, in use_alias..alias_decorator..new_module(*args, **kwargs)
    587     msg = (
    588         "Parameters 'Y' and 'yshift' are deprecated since v0.8.0. "
    589         "and will be removed in v0.12.0. "
    590         "Use Figure.shift_origin(yshift=...) instead."
    591     )
    592     warnings.warn(msg, category=SyntaxWarning, stacklevel=2)
--> 594 return module_func(*args, **kwargs)
...
    511         f"Module '{module}' failed with status code {status}:\n{self._error_message}"
    512     )

GMTCLibError: Module 'grdimage' failed with status code 72:
grdimage [ERROR]: Option -Q parsing failure.  Correct syntax:

EDIT: please format your post.