cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
wskamoun
Level II

setting absolute minimum and maximum in color bar of heatmap

I am making heatmaps and I would like to control the scale of the color. Meaning that although the data might range from 1-10 I would like to be able to use a specific minimum and maximum in the color bar and if possible control the spacing.

he same question would apply to the size of dot if I am using size as a 3rd dimension of a scatter plot.

Thanks

Walid

1 ACCEPTED SOLUTION

Accepted Solutions
XanGregg
Staff

Re: setting absolute minimum and maximum in color bar of heatmap

Yes. The most straightforward way is to customize the scale once interactively, and then save the script and use that as a template. The script will include an embedded "SendToReport" part, but that can be separated from the initial script and executed repeatedly as you adjust the values.

For instance, the saved customized script might be:


Graph Builder(


  Size( 519, 447 ),


  Show Control Panel( 0 ),


  Variables( X( :age ), Y( :sex ), Color( :height ) ),


  Elements( Heatmap( X, Y, Legend( 5 ) ) ),


  SendToReport(


    Dispatch( {}, "400", ScaleBox,


    {Legend Model( 5,


      Properties( 0,


      {gradient( {Scale Values( [50 65 75] ), Width( 12 )} )}) ))}


  ))


);


which can be written separately as:


gb = Graph Builder(


  Size( 519, 447 ),


  Show Control Panel( 0 ),


  Variables( X( :age ), Y( :sex ), Color( :height ) ),


  Elements( Heatmap( X, Y, Legend( 5 ) ) )


);




gb<<SendToReport( Dispatch( {}, "400", ScaleBox,


  {Legend Model( 5,


  Properties( 0, {gradient( {Scale Values( [50 65 75] )} )} ) )})


  );


The number 5 in this case is an identifier for the legend, in case of multiple element, each having its own legend.

View solution in original post

4 REPLIES 4
XanGregg
Staff

Re: setting absolute minimum and maximum in color bar of heatmap

You can right-click on the gradient in the Graph Builder legend to get a Gradient Settings dialog where you can customize the range and other aspects of the gradient.

7526_gradient.png

Re: setting absolute minimum and maximum in color bar of heatmap

Is there some way to change the gradient values programmatically to a Graph Builder that's already been put on the screen? I'd like to be able to change the min/center/max values dynamically to allow the user to optimize for maximum contrast in data that's been displayed. Ideally I'd make a slider box for each...

Thanks!

XanGregg
Staff

Re: setting absolute minimum and maximum in color bar of heatmap

Yes. The most straightforward way is to customize the scale once interactively, and then save the script and use that as a template. The script will include an embedded "SendToReport" part, but that can be separated from the initial script and executed repeatedly as you adjust the values.

For instance, the saved customized script might be:


Graph Builder(


  Size( 519, 447 ),


  Show Control Panel( 0 ),


  Variables( X( :age ), Y( :sex ), Color( :height ) ),


  Elements( Heatmap( X, Y, Legend( 5 ) ) ),


  SendToReport(


    Dispatch( {}, "400", ScaleBox,


    {Legend Model( 5,


      Properties( 0,


      {gradient( {Scale Values( [50 65 75] ), Width( 12 )} )}) ))}


  ))


);


which can be written separately as:


gb = Graph Builder(


  Size( 519, 447 ),


  Show Control Panel( 0 ),


  Variables( X( :age ), Y( :sex ), Color( :height ) ),


  Elements( Heatmap( X, Y, Legend( 5 ) ) )


);




gb<<SendToReport( Dispatch( {}, "400", ScaleBox,


  {Legend Model( 5,


  Properties( 0, {gradient( {Scale Values( [50 65 75] )} )} ) )})


  );


The number 5 in this case is an identifier for the legend, in case of multiple element, each having its own legend.

Re: setting absolute minimum and maximum in color bar of heatmap

Hi,

Well, I was trying to do that on a Points + Contour graph, and that "Copy Script" procedure didn't work, because the Contour graph uses a Legend Model 10, whereas the Points used Legend Model 11. Model 10 doesn't allow you to set the range of the gradient. HOWEVER, I can force the Legend Model to be 11 for both the Contour and the Points:

   Elements(
   Contour( X, Y, Legend( 11 ) ), //It's Legend(10) normally!
   Points( X, Y, Legend( 11 ), Jitter( 1 ) )
   ),

I can then do a SendToReport to the Legend Model 11, which modifies the gradient values for both the Contour and the Points, simultaneously.

gb << SendToReport( Dispatch( {}, "400", ScaleBox,

    {Legend Model( 11,

        Properties(0, {gradient( {Label Levels( [10 50 1100] )} )} ) )} ) );

So it looks like I'll be able to do what I need.

Too bad none of this is documented for users...

Thanks for the help!