cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
%3CLINGO-SUB%20id%3D%22lingo-sub-712318%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EC%C3%B3mo%20utilizar%20variables%20en%20valores%20de%20escala%20(de%20un%20mapa%20de%20calor)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-712318%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EHola%20a%20todos%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EEn%20el%20siguiente%20ejemplo%2C%20se%20cre%C3%B3%20un%20mapa%20de%20calor%20utilizando%20Big%20Class.jmp%20como%20ejemplo%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3Egb%3DGraph%20Builder(%0A%20Size(%20686%2C%20525%20)%2C%0A%20Show%20Control%20Panel(%200%20)%2C%0A%20Variables(%20X(%20%3Aweight%20)%2C%20Y(%20%3Aheight%20)%2C%20Color(%20%3Aage%20)%20)%2C%0A%20Elements(%20Heatmap(%20X%2C%20Y%2C%20Legend(%207%20)%20)%20)%2C%0A%20SendToReport(%0A%20%20Dispatch(%0A%20%20%20%7B%7D%2C%0A%20%20%20%22400%22%2C%0A%20%20%20ScaleBox%2C%0A%20%20%20%7BLegend%20Model(%0A%20%20%20%207%2C%0A%20%20%20%20Properties(%0A%20%20%20%20%200%2C%0A%20%20%20%20%20%7Bgradient(%20%7BScale%20Values(%20%5B11%2018%5D%20)%7D%20)%7D%2C%0A%20%20%20%20%20Item%20ID(%20%22age%22%2C%201%20)%0A%20%20%20%20)%0A%20%20%20)%7D%0A%20%20)%0A%20)%0A)%3B%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%C2%BFHay%20alguna%20forma%20de%20utilizar%20variables%20para%20definir%20los%20l%C3%ADmites%20de%20la%20escala%20de%20gradiente%3F%20Esto%20es%20lo%20que%20me%20gustar%C3%ADa%20lograr%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3Egradient_low%3D10%3B%0Agradient_high%3D19%3B%0A%0Agb%3DGraph%20Builder(%0A%20Size(%20686%2C%20525%20)%2C%0A%20Show%20Control%20Panel(%200%20)%2C%0A%20Variables(%20X(%20%3Aweight%20)%2C%20Y(%20%3Aheight%20)%2C%20Color(%20%3Aage%20)%20)%2C%0A%20Elements(%20Heatmap(%20X%2C%20Y%2C%20Legend(%207%20)%20)%20)%2C%0A%20SendToReport(%0A%20%20Dispatch(%0A%20%20%20%7B%7D%2C%0A%20%20%20%22400%22%2C%0A%20%20%20ScaleBox%2C%0A%20%20%20%7BLegend%20Model(%0A%20%20%20%207%2C%0A%20%20%20%20Properties(%0A%20%20%20%20%200%2C%0A%20%20%20%20%20%7Bgradient(%20%7BScale%20Values(%20matrix(%7B%3CFONT%20face%3D%22arial%20black%2Cavant%20garde%22%20color%3D%22%23FF0000%22%3Egradient_low%3C%2FFONT%3E%2C%20%3CFONT%20face%3D%22arial%20black%2Cavant%20garde%22%20color%3D%22%23FF0000%22%3Egradient_high%3C%2FFONT%3E%7D)%20)%7D%20)%7D%2C%0A%20%20%20%20%20Item%20ID(%20%22age%22%2C%201%20)%0A%20%20%20%20)%0A%20%20%20)%7D%0A%20%20)%0A%20)%0A)%3B%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMe%20gustar%C3%ADa%20utilizar%20%22grandient_low%22%20y%20%22gradient_high%22%20para%20definir%20los%20l%C3%ADmites%20de%20gradiente%20del%20mapa%20de%20calor.%3C%2FP%3E%3CP%3EIntent%C3%A9%20usar%20eval()%20%2C%20eval%20expr()%2C%20etc.%20pero%20a%C3%BAn%20no%20lo%20he%20hecho%20funcionar.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EGracias%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-712318%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CLINGO-LABEL%3EAutomatizaci%C3%B3n%20y%20secuencias%20de%20comandos%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-712340%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%3A%20C%C3%B3mo%20utilizar%20variables%20en%20valores%20de%20escala%20(de%20un%20mapa%20de%20calor)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-712340%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EPuede%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3ENames%20Default%20To%20Here(1)%3B%20%0A%0Adt%20%3D%20Open(%22%24SAMPLE_DATA%2FBig%20Class.jmp%22)%3B%0A%0Agradient_low%20%3D%2010%3B%0Agradient_high%20%3D%2019%3B%0A%0Agb%20%3D%20Eval(EvalExpr(dt%20%26lt%3B%26lt%3B%20Graph%20Builder(%0A%20Size(686%2C%20525)%2C%0A%20Show%20Control%20Panel(0)%2C%0A%20Variables(X(%3Aweight)%2C%20Y(%3Aheight)%2C%20Color(%3Aheight))%2C%0A%20Elements(Heatmap(X%2C%20Y%2C%20Legend(7)))%2C%0A%20SendToReport(%0A%20%20Dispatch(%0A%20%20%20%7B%7D%2C%0A%20%20%20%22400%22%2C%0A%20%20%20ScaleBox%2C%0A%20%20%20%7BLegend%20Model(%0A%20%20%20%207%2C%0A%20%20%20%20Properties(%0A%20%20%20%20%200%2C%0A%20%20%20%20%20%7Bgradient(%7BScale%20Values(Expr(Matrix(%7Bgradient_low%2C%20gradient_high%7D)%60))%7D)%7D%2C%0A%20%20%20%20%20Item%20ID(%22height%22%2C%201)%0A%20%20%20%20)%0A%20%20%20)%7D%0A%20%20)%0A%20)%0A)))%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3Epero%20lo%20m%C3%A1s%20probable%20es%20que%20utilice%20Legend%20Server%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3ENames%20Default%20To%20Here(1)%3B%20%0A%0Adt%20%3D%20Open(%22%24SAMPLE_DATA%2FBig%20Class.jmp%22)%3B%0A%0Agradient_low%20%3D%2010%3B%0Agradient_high%20%3D%2019%3B%0A%0Agb%20%3D%20dt%20%26lt%3B%26lt%3B%20Graph%20Builder(%0A%20Size(686%2C%20525)%2C%0A%20Show%20Control%20Panel(0)%2C%0A%20Variables(X(%3Aweight)%2C%20Y(%3Aheight)%2C%20Color(%3Aheight))%2C%0A%20Elements(Heatmap(X%2C%20Y%2C%20Legend(7)))%2C%0A)%3B%0A%0Am_gradient%20%3D%20Matrix(%7Bgradient_low%2C%20gradient_high%7D)%60%3B%0A%0Aserver%20%3D%20gb%20%26lt%3B%26lt%3B%20Get%20Legend%20Server%3B%0Aitems%20%3D%20server%20%26lt%3B%26lt%3B%20Get%20Legend%20Items%3B%0Aitems%5B1%5D%5B1%5D%20%26lt%3B%26lt%3B%20Set%20Properties(%7Bgradient(%7BScale%20Values(m_gradient)%7D)%7D)%3B%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-712343%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%3A%20C%C3%B3mo%20utilizar%20variables%20en%20valores%20de%20escala%20(de%20un%20mapa%20de%20calor)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-712343%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F54010%22%20target%3D%22_blank%22%3E%40LatentDataTiger%3C%2FA%3E%3C%2FP%3E%0A%3CP%3ELo%20que%20afirma%20Jarmo%20es%20correcto.Sin%20embargo%2C%20ha%20hecho%20un%20cambio%20en%20su%20ejemplo%20que%20tal%20vez%20no%20se%20note.Su%20ejemplo%20utiliza%20la%20variable%20Edad%20como%20columna%20Color%2C%20donde%20Jarmo%20la%20cambi%C3%B3%20a%20Altura.La%20diferencia%20es%20que%20la%20edad%20tiene%20un%20tipo%20de%20modelado%20ordinal%20y%20la%20altura%20tiene%20un%20tipo%20de%20modelado%20continuo.Una%20columna%20ordinal%20no%20respetar%C3%A1%20los%20valores%20de%20gradiente.Para%20hacer%20esto%20por%20edad%2C%20necesita%20cambiar%20el%20tipo%20de%20modelado%20de%20la%20columna.Aqu%C3%AD%20hay%20un%20script%20que%20establece%20el%20degradado%20de%20color%20especificado%20para%20su%20ejemplo%20original.%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3ENames%20Default%20To%20Here(%201%20)%3B%0Adt%20%3D%20%0A%2F%2F%20Open%20Data%20Table%3A%20Big%20Class.jmp%0A%2F%2F%20%E2%86%92%20Data%20Table(%20%22Big%20Class%22%20)%0AOpen(%20%22%24SAMPLE_DATA%2FBig%20Class.jmp%22%20)%3B%0A%0Adt%3Aage%20%26lt%3B%26lt%3B%20modeling%20type(%20continuous%20)%3B%0A%0Agradient_low%20%3D%2010%3B%0Agradient_high%20%3D%2019%3B%0A%0AEval(%0A%20Eval%20Expr(%0A%20%20gb%20%3D%20Graph%20Builder(%0A%20%20%20Size(%20686%2C%20525%20)%2C%0A%20%20%20Show%20Control%20Panel(%200%20)%2C%0A%20%20%20Variables(%20X(%20%3Aweight%20)%2C%20Y(%20%3Aheight%20)%2C%20Color(%20%3Aage%20)%20)%2C%0A%20%20%20Elements(%20Heatmap(%20X%2C%20Y%2C%20Legend(%207%20)%20)%20)%2C%0A%20%20%20SendToReport(%0A%20%20%20%20Dispatch(%0A%20%20%20%20%20%7B%7D%2C%0A%20%20%20%20%20%22400%22%2C%0A%20%20%20%20%20ScaleBox%2C%0A%20%20%20%20%20%7BLegend%20Model(%0A%20%20%20%20%20%207%2C%0A%20%20%20%20%20%20Properties(%0A%20%20%20%20%20%20%200%2C%0A%20%20%20%20%20%20%20%7Bgradient(%0A%20%20%20%20%20%20%20%20%7BScale%20Values(%20Matrix(%20%7BExpr(%20gradient_low%20)%2C%20Expr(%20gradient_high%20)%7D%20)%20)%7D%0A%20%20%20%20%20%20%20)%7D%2C%0A%20%20%20%20%20%20%20Item%20ID(%20%22age%22%2C%201%20)%0A%20%20%20%20%20%20)%0A%20%20%20%20%20)%7D%0A%20%20%20%20)%0A%20%20%20)%0A%20%20)%0A%20)%0A)%0A%3B%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-712347%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%3A%20C%C3%B3mo%20utilizar%20variables%20en%20valores%20de%20escala%20(de%20un%20mapa%20de%20calor)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-712347%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EHola%20Jarmo%20y%20Jim.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EEstoy%20muy%20interesado%20en%20aprender%20la%20t%C3%A9cnica%20del%20servidor%20legendario%2C%20pero%20la%20%C3%BAltima%20l%C3%ADnea%20de%20tu%20script%20no%20funcion%C3%B3.%20Aqu%C3%AD%20est%C3%A1%20el%20error%20que%20recibo%3A%3C%2FP%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3Eobject%20not%20subscriptable%20in%20access%20or%20evaluation%20of%20'items%5B1%5D%5B1%5D'%20%2C%20items%5B1%5D%5B%2F*%23%23%23*%2F1%5D%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%C2%BFPuedes%20ayudarme%20a%20comprobar%20la%20%C3%BAltima%20l%C3%ADnea%3F%3C%2FP%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3ENames%20Default%20To%20Here(1)%3B%20%0A%0Adt%20%3D%20Open(%22%24SAMPLE_DATA%2FBig%20Class.jmp%22)%3B%0A%0Agradient_low%20%3D%2010%3B%0Agradient_high%20%3D%2019%3B%0A%0Agb%20%3D%20dt%20%26lt%3B%26lt%3B%20Graph%20Builder(%0A%20Size(686%2C%20525)%2C%0A%20Show%20Control%20Panel(0)%2C%0A%20Variables(X(%3Aweight)%2C%20Y(%3Aheight)%2C%20Color(%3Aheight))%2C%0A%20Elements(Heatmap(X%2C%20Y%2C%20Legend(7)))%2C%0A)%3B%0A%0Am_gradient%20%3D%20Matrix(%7Bgradient_low%2C%20gradient_high%7D)%3B%0A%0Aserver%20%3D%20gb%20%26lt%3B%26lt%3B%20Get%20Legend%20Server%3B%0Aitems%20%3D%20server%20%26lt%3B%26lt%3B%20Get%20Legend%20Items%3B%0Aitems%5B1%5D%5B1%5D%20%26lt%3B%26lt%3B%20Set%20Properties(%7Bgradient(%7BScale%20Values(m_gradient)%7D)%7D)%3B%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EGracias%2C%3C%2FP%3E%3CP%3Erex%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-712350%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%3A%20C%C3%B3mo%20utilizar%20variables%20en%20valores%20de%20escala%20(de%20un%20mapa%20de%20calor)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-712350%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EQuiz%C3%A1s%20podr%C3%ADa%20estar%20relacionado%20con%20la%20versi%C3%B3n.%20%C2%BFQu%C3%A9%20versi%C3%B3n%20de%20JMP%20est%C3%A1s%20usando%3F%20Estoy%20usando%20JMP%2017.2.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-712352%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%3A%20C%C3%B3mo%20utilizar%20variables%20en%20valores%20de%20escala%20(de%20un%20mapa%20de%20calor)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-712352%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EActualmente%20estoy%20usando%20JMP%2015%20y%2016.%20Tengo%20JMP%2017%2C%20pero%20algunas%20de%20las%20herramientas%20que%20desarrollaron%20mis%20colegas%20no%20funcionaban%20en%20JMP17%2C%20as%C3%AD%20que%20decid%C3%AD%20quedarme%20con%2015%20y%2016.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Choose Language Hide Translation Bar

How to use variables in scale values (of a heat map)

Hi All, 

 

In the following example, a heat map was created using Big Class.jmp as an example:

 

gb=Graph Builder(
	Size( 686, 525 ),
	Show Control Panel( 0 ),
	Variables( X( :weight ), Y( :height ), Color( :age ) ),
	Elements( Heatmap( X, Y, Legend( 7 ) ) ),
	SendToReport(
		Dispatch(
			{},
			"400",
			ScaleBox,
			{Legend Model(
				7,
				Properties(
					0,
					{gradient( {Scale Values( [11 18] )} )},
					Item ID( "age", 1 )
				)
			)}
		)
	)
);

 Is there a way to use variables to define the gradient scale limits? Here's what I'd like to achieve:

 

 

gradient_low=10;
gradient_high=19;

gb=Graph Builder(
	Size( 686, 525 ),
	Show Control Panel( 0 ),
	Variables( X( :weight ), Y( :height ), Color( :age ) ),
	Elements( Heatmap( X, Y, Legend( 7 ) ) ),
	SendToReport(
		Dispatch(
			{},
			"400",
			ScaleBox,
			{Legend Model(
				7,
				Properties(
					0,
					{gradient( {Scale Values( matrix({gradient_low, gradient_high}) )} )},
					Item ID( "age", 1 )
				)
			)}
		)
	)
);

 

 

I would like to use "grandient_low" and "gradient_high" to define the heatmap gradient limits.

I've tried to use eval() , eval expr(), etc. but haven't got it to work yet. 

 

Thanks

 

5 REPLIES 5
jthi
Super User

Re: How to use variables in scale values (of a heat map)

You can

Names Default To Here(1); 

dt = Open("$SAMPLE_DATA/Big Class.jmp");

gradient_low = 10;
gradient_high = 19;

gb = Eval(EvalExpr(dt << Graph Builder(
	Size(686, 525),
	Show Control Panel(0),
	Variables(X(:weight), Y(:height), Color(:height)),
	Elements(Heatmap(X, Y, Legend(7))),
	SendToReport(
		Dispatch(
			{},
			"400",
			ScaleBox,
			{Legend Model(
				7,
				Properties(
					0,
					{gradient({Scale Values(Expr(Matrix({gradient_low, gradient_high})`))})},
					Item ID("height", 1)
				)
			)}
		)
	)
)));

but I would most likely go through Legend Server

Names Default To Here(1); 

dt = Open("$SAMPLE_DATA/Big Class.jmp");

gradient_low = 10;
gradient_high = 19;

gb = dt << Graph Builder(
	Size(686, 525),
	Show Control Panel(0),
	Variables(X(:weight), Y(:height), Color(:height)),
	Elements(Heatmap(X, Y, Legend(7))),
);

m_gradient = Matrix({gradient_low, gradient_high})`;

server = gb << Get Legend Server;
items = server << Get Legend Items;
items[1][1] << Set Properties({gradient({Scale Values(m_gradient)})});
-Jarmo
txnelson
Super User

Re: How to use variables in scale values (of a heat map)

@LatentDataTiger 

What Jarmo states is correct.  However, he has made a change to your example that may not be noticed.  Your example uses the variable Age as the Color column, where Jarmo has changed it to Height.  The difference is, that Age has a Modeling Type of Ordinal, and Height has a  Modeling Type of Continuous.  An ordinal column will not honor the Gradient values.  To do this for age, you need to change the Modeling Type of the column.  Here is a script that  sets the specified color gradient for your original example.

Names Default To Here( 1 );
dt = 
// Open Data Table: Big Class.jmp
// → Data Table( "Big Class" )
Open( "$SAMPLE_DATA/Big Class.jmp" );

dt:age << modeling type( continuous );

gradient_low = 10;
gradient_high = 19;

Eval(
	Eval Expr(
		gb = Graph Builder(
			Size( 686, 525 ),
			Show Control Panel( 0 ),
			Variables( X( :weight ), Y( :height ), Color( :age ) ),
			Elements( Heatmap( X, Y, Legend( 7 ) ) ),
			SendToReport(
				Dispatch(
					{},
					"400",
					ScaleBox,
					{Legend Model(
						7,
						Properties(
							0,
							{gradient(
								{Scale Values( Matrix( {Expr( gradient_low ), Expr( gradient_high )} ) )}
							)},
							Item ID( "age", 1 )
						)
					)}
				)
			)
		)
	)
)
;
Jim

Re: How to use variables in scale values (of a heat map)

Hi Jarmo and Jim

 

 

I'm very interesting in learning the legend server technique, but the last line of your script didn't work. Here's the error I get:

object not subscriptable in access or evaluation of 'items[1][1]' , items[1][/*###*/1]

Can you please help check the last line in

Names Default To Here(1); 

dt = Open("$SAMPLE_DATA/Big Class.jmp");

gradient_low = 10;
gradient_high = 19;

gb = dt << Graph Builder(
	Size(686, 525),
	Show Control Panel(0),
	Variables(X(:weight), Y(:height), Color(:height)),
	Elements(Heatmap(X, Y, Legend(7))),
);

m_gradient = Matrix({gradient_low, gradient_high});

server = gb << Get Legend Server;
items = server << Get Legend Items;
items[1][1] << Set Properties({gradient({Scale Values(m_gradient)})});

 

Thanks, 

rex

jthi
Super User

Re: How to use variables in scale values (of a heat map)

Could maybe be version related. Which JMP version are you using? I'm using JMP 17.2.

-Jarmo

Re: How to use variables in scale values (of a heat map)

I'm currently using JMP 15 and 16. I do have JMP 17, but some of my tool box that my colleagues developed wouldn't work in JMP17, so I decided to stay with 15 and 16.