Skip to main content

Hi,

 

I would like to make a heatmap of a field on a red gradient, but make all negative values black.  I tried red-black-white diverging (reversed), but I do not want the white shades in between.  I basically want the gradient to start on positive numbers at red instead of white.

 

Please let me know if this is possible.

 

Thanks,

John

답변 3개
  1. 2018년 10월 2일 오전 1:05

    The problem is that most of the built-in diverging color palettes go from one color to another meeting at white or grey in the middle, but you can create your own custom palette that does not do this. Here's how: Create Custom Color Palettes

     

    I created the following palette that goes from black to a bright red:

     

    <color-palette name="Black/Red Diverging" type="ordered-diverging" >

    <color>#000000</color>

    <color>#FF0000</color>

    </color-palette>

     

    Using superstore, I dropped Profit on the Color card, then chose this palette:

    The problem is that most of the built-in diverging color palettes go from one color to another meeting at white or grey in the middle, but you can create your own custom palette that does not do this.

    However, it still shows a range of colors (not all negatives are black), so I created a calculated field as follows:

     

    Color

    IF SUM([Profit])<0 THEN

        0

    ELSE

        SUM([Profit])

    END

     

    I then dragged this to the color card and chose the palette:

    pastedImage_8.png

    Close, but one of the problems with this is that low values still show very black. If you want postitive values to be more red, then you can fiddle with the color palette settings. For example, here I've selected "Use Full Color Range" and set the Center at 500:

    pastedImage_9.png

    pastedImage_10.png

    See attached workbook.

0/9000