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
Choose Language Hide Translation Bar
lala
Level VIII

How to implement these two figures in the same diagram?

Thanks Experts!

Use both groups x:

2024-04-24_11-08-39.png

6 REPLIES 6
lala
Level VIII

回复: How to implement these two figures in the same diagram?

d0=Open("$SAMPLE_DATA/Big Class.jmp");
d0 << Select Where( age < 16 );
dt = d0 << Subset(
	Output Table( "test" ),
	Selected Rows( 1 ),
	selected columns( 0 )
);
Try( dt << Delete Table Property( "Source" ) );
d2 = dt << Summary(
	Group( age ),
	Freq( 0 ),
	Weight( 0 ),
	Link to original data table( 0 ),
	Output Table( "tem" )
);
Column( d2, 2 ) << set name( "row" );
mi = Min( d2[0, "row"] );
ca = "ratio";
New Column( ca );
Column( ca ) << Formula( Round( row / mi, 2 ) );
d2 << run formulas;
Column( ca ) << deleteFormula;
dt << Update( With( d2 ), Match Columns( age = age ) );
Close( d2, nosave );
Current Data Table( dt );
ca = "list";
New Column( ca );
Column( ca ) << Formula(
	If( Row() == 1 | age != Lag( age, 1 ),
		r = Row();
		1;
	,
		Floor( (Row() - r) / ratio + 1 )
	)
);
d0 << run formulas;
Column( ca ) << deleteFormula;

2024-04-24_11-16-39.png

p1 = dt << Graph Builder(
	Size( 690, 466 ),
	Show Control Panel( 0 ),
	Show Legend( 0 ),
	Show X Axis( 0 ),
	Show Y Axis( 0 ),
	Variables(
		X( :weight ),
		Y( :height ),
		Group X( :age, Show Title( 0 ) ),
		Color( :sex )
	),
	Elements(
		Bar(
			X,
			Y,
			Legend( 5 ),
			Response Axis( "X" ),
			Summary Statistic( "Sum" )
		)
	),
	SendToReport(
		Dispatch(
			{},
			"graph title",
			TextEditBox,
			{Hide( 1 )}
		),
		Dispatch( {}, "X title", TextEditBox, {Hide( 1 )} ),
		Dispatch( {}, "Y title", TextEditBox, {Hide( 1 )} )
	)
);

p2 = dt << Graph Builder(
	Size( 686, 404 ),
	Show Control Panel( 0 ),
	Show Legend( 0 ),
	Show X Axis( 0 ),
	Show Y Axis( 0 ),
	X Group Edge( "Bottom" ),
	Variables(
		X( :list ),
		Y( :height ),
		Group X( :age, Show Title( 0 ) )
	),
	Elements(
		Bar( X, Y, Legend( 5 ), Summary Statistic( "Sum" ) )
	),
	SendToReport(
		Dispatch(
			{},
			"graph title",
			TextEditBox,
			{Hide( 1 )}
		),
		Dispatch( {}, "X title", TextEditBox, {Hide( 1 )} ),
		Dispatch( {}, "Y title", TextEditBox, {Hide( 1 )} )
	)
);
jthi
Super User

回复: How to implement these two figures in the same diagram?

I would say you cannot (and should not) have them in same graphs as they are displaying different information (at least based on your graph builder scripts). You could combine then into single "report" if needed by using Combine Windows

jthi_0-1713943358594.png

 

-Jarmo
hogi
Level XII

回复: How to implement these two figures in the same diagram?

you could rescale "list" by x 30 and use it on the X axis - which will  give this graph:

hogi_0-1713945002509.png

 

 

 

View more...
dt << New Column( "list*30",
	Formula( :list * 30 )
);
dt << Graph Builder(
	Variables(
		X( :weight ),
		X( :"list*30"n, Position( 1 ) ),
		Y( :height ),
		Y( :height ),
		Group X( :age, Show Title( 0 ) ),
		Color( :sex )
	),
	Elements(
		Position( 1, 1 ),
		Bar(
			X( 1 ),
			Y,
			Legend( 5 ),
			Response Axis( "X" ),
			Summary Statistic( "Sum" )
		)
	),
	Elements(
		Position( 1, 2 ),
		Bar( X( 2 ), Y, Color( 0 ), Legend( 6 ), Summary Statistic( "Sum" ) )
	)
);
lala
Level VIII

回复: How to implement these two figures in the same diagram?

Is this a mistake?

Thanks Experts!

2024-04-24_16-08-19.png

hogi
Level XII

回复: How to implement these two figures in the same diagram?

Thanks, I corrected it in the code.

 

with the original column ("list") the bottom graph will be squeezed to the left.

with "list*30" the bars will fill the whole graph.

 

 

lala
Level VIII

回复: How to implement these two figures in the same diagram?

d0 = Current Data Table();
d0 << Select Where( age < 16 );
dt = d0 << Subset( Output Table( "test" ), Selected Rows( 1 ), selected columns( 0 ) );
Try( dt << Delete Table Property( "Source" ) );
d2 = dt << Summary( Group( age, height ), Sum( weight ), Freq( 0 ), Weight( 0 ), Link to original data table( 0 ), Output Table( "tem" ) );
ma = Max( d2[0, 4] );Close( d2, nosave );
d2 = dt << Summary( Group( age ), Freq( 0 ), Weight( 0 ), Link to original data table( 0 ), Output Table( "tem" ) );Column( d2, 2 ) << set name( "row" );
mi = Min( d2[0, "row"] );
ca = "ratio";New Column( ca );Column( ca ) << Formula( Round( row / mi, 2 ) );d2 << run formulas;Column( ca ) << deleteFormula;
dt << Update( With( d2 ), Match Columns( age = age ) );Close( d2, nosave );
Current Data Table( dt );ca = "list";New Column( ca );
Column( ca ) << Formula(If( Row() == 1 | age != Lag( age, 1 ),r = Row();1,Ceiling( (Row() - r + 1) / ratio * ma / mi )	));d0 << run formulas;Column( ca ) << deleteFormula;