Skip to main content
added 101 characters in body
Source Link
Simigant
  • 151
  • 1
  • 5

I couldn't find a solution that worked apart from building my own colormap. This function will make the lowest 100 values in the scale transparent

    def cmap(cm, scale=9999):
        from matplotlib.colors import ListedColormap
        ncm = np.zeros((scale, 4))

        pcm = ListedColormap(ncm)

        ncm = np.vstack((pcm(np.linspace(0, 1, 100)), cm(np.linspace(0, 1, 2000)))
           )

        return ListedColormap(ncm)
    cmap(matplotlip.colormap.viridis)

Worked off this document https://matplotlib.org/3.1.0/tutorials/colors/colormap-manipulation.html

I couldn't find a solution that worked apart from building my own colormap. This function will make the lowest 100 values in the scale transparent

    def cmap(cm, scale=9999):
        from matplotlib.colors import ListedColormap
        ncm = np.zeros((scale, 4))

        pcm = ListedColormap(ncm)

        ncm = np.vstack((pcm(np.linspace(0, 1, 100)), cm(np.linspace(0, 1, 2000)))
           )

        return ListedColormap(ncm)
    cmap(matplotlip.colormap.viridis)

I couldn't find a solution that worked apart from building my own colormap. This function will make the lowest 100 values in the scale transparent

    def cmap(cm, scale=9999):
        from matplotlib.colors import ListedColormap
        ncm = np.zeros((scale, 4))

        pcm = ListedColormap(ncm)

        ncm = np.vstack((pcm(np.linspace(0, 1, 100)), cm(np.linspace(0, 1, 2000)))
           )

        return ListedColormap(ncm)
    cmap(matplotlip.colormap.viridis)

Worked off this document https://matplotlib.org/3.1.0/tutorials/colors/colormap-manipulation.html

Source Link
Simigant
  • 151
  • 1
  • 5

I couldn't find a solution that worked apart from building my own colormap. This function will make the lowest 100 values in the scale transparent

    def cmap(cm, scale=9999):
        from matplotlib.colors import ListedColormap
        ncm = np.zeros((scale, 4))

        pcm = ListedColormap(ncm)

        ncm = np.vstack((pcm(np.linspace(0, 1, 100)), cm(np.linspace(0, 1, 2000)))
           )

        return ListedColormap(ncm)
    cmap(matplotlip.colormap.viridis)