Subscribe Bookmark RSS Feed

Color gradient based on absolute value?

smushieduckface

Community Trekker

Joined:

Jul 17, 2014

Hi,

I am trying to color a column based on the sigma distance from target instead of from lowest to highest.

For example, I want a color gradient from the smallest value to the largest value so from 0.07 to 0.64 (with -0.54 having the same color as +0.54). I do want to keep the negative signs so that I know which side of the target it is on.

Here is some example data:

0.07

-0.24

-0.54

-0.26

-0.64

0.09

0.30

0.03

-0.15

0.54

Is this possible to do in a JMP script? Any ideas?

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

I've attached a small example script that colors "height" column cells in BigClass.jmp according to a distance from a  target value.

Here's a sampling of the result using a target of 60.

7039_specialValueColoring.PNG

Notice that 59 and 61 have the same color because they're both 1 away from the target.

I hope you will be able to adapt the script to your data table.

3 REPLIES
XanGregg

Staff

Joined:

Jun 23, 2011

Two possibilities:

  1. Create a new column which is the absolute value of the first and use that for color, but still use the first column for labeling.
  2. Create a custom color gradient that's symmetric. For instance, black to white to black with a centered value scale. If you really need 0.07 to be the minimum, you can create a constant color zone in the middle. That is black-to-white-to-white-to-black.
Solution

I've attached a small example script that colors "height" column cells in BigClass.jmp according to a distance from a  target value.

Here's a sampling of the result using a target of 60.

7039_specialValueColoring.PNG

Notice that 59 and 61 have the same color because they're both 1 away from the target.

I hope you will be able to adapt the script to your data table.

smushieduckface

Community Trekker

Joined:

Jul 17, 2014

Thank you so much! I had tried the second option but it didn't seem to work unless the range was equal on both sides.

John, your script worked great. I really appreciate it. Thanks!