[Python] Is there a cmap which goes from transparant to black (or any other color)?

Discussão em 'Python' iniciado por Stack, Junho 26, 2025.

  1. Stack

    Stack Membro Participativo

    I'm using the following cmap="binary" on a datasets with zeros and ones. The cmap goes from white to black. This results in the following figure:

    Black and white figure:

    [​IMG]

    Because I want to overlap this graph with an existing graph, I want to keep the black but make the white transparant.

    Overlapping image with white:

    [​IMG]

    Is there a cmap which goes from transparancy to black ?

    I'm using the following code to plot the graphs:

    plt.pcolor(mp1,cmap="binary",alpha=0.5)

    Continue reading...

Compartilhe esta Página