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
Thierry_S
Super User

Add Summary Table at Bottom of Plots in Graph Builder > Multi Panel Aggregated Plots?

Hi JMP Community,

I have written a simple (and a bit clunky) script  that assembles multiple GB plots into a window using a LineUpBox into which I append the FrameBox from each plot: it works perfectly running across 182 biomarkers and assembling the plots for which certain conditions are met; (see below). Of note, I cannot easily share the data table associated with this script because the of the confidential nature of the data.

Names Default to Here (1);

dt = Current Data Table ();

CLX = dt << get column names (string);

CList = {};

For (i= 1, i <= N Items (CLX), i++, insert into (CList, substitute (CLX[i], "LSMEAN ", "")));

gbe = Expr (dt << Graph Builder(
				Size( 360, 360 ),
				Fit to Window( "Off" ),
				Level Frame Color( "Medium Dark Gray" ),
				Level Spacing Color( "Medium Dark Gray" ),
				Level Underline( 1 ),
				Page Level Underline( 0 ),
				Spacing Borders( 1 ),
				Variables(
					X( :Name( "DURATION (Week)" ) ),
					Y( _YS_ ),
					Overlay( :ARM ),
					Interval( _STE_ )
				),
				Elements(
					Points( X, Y, Legend( 5 ) ),
					Line( X, Y, Interval( 0 ), Legend( 6 ) )
				),
				SendToReport(
					Dispatch(
						{},
						"DURATION (Week)",
						ScaleBox,
						{Min( -1.5 ), Max( 10 ), Inc( 2 ), Minor Ticks( 1 )}
					),
					
					Dispatch(
						{},
						"Graph Builder",
						FrameBox,
						{Marker Size( 6 ), Add Graphics Script(
							2,
							Description( "Script" ),
							Text Color (Black);
							Pen Color (black);
							Pen size (2);
							Line style ("Dotted");
							H Line (0);
							Text Size (14);
							Text( Center Justified, {4, _BPY_}, _LNAME_);
							Text size (12);
							Text Color( blue );
							Text( Center Justified, {2, _TPY1_}, _P1_);
							Text( Center Justified, {8, _TPY1_}, _P2_);
							Text Color( Green );
							Text( Center Justified, {2, _TPY2_}, _P3_);
							Text( Center Justified, {8, _TPY2_}, _P4_);
							Text Color( purple );
							Text( Center Justified, {2, _TPY3_}, _P5_);
							Text( Center Justified, {8, _TPY3_}, _P6_);
						), Grid Line Order( 5 ), Reference Line Order( 6 )}
					)
				)
			)
		);	


mylbox = Lineup Box (N Col (8));

For (i = 4, i <= 185, i++, //185
	
		YCOL = Column (i);
		STDE = Column (i+182);
		LABEL = CList [i];
		
		P1 = Column (dt, i+364) [2];
		P2 = Column (dt, i+364) [3];
		P3 = Column (dt, i+364) [5];
		P4 = Column (dt, i+364) [6];
		P5 = Column (dt, i+364) [8];
		P6 = Column (dt, i+364) [9];
		
		PPBO1 = Column (dt, i+546) [5];
		PPBO2 = Column (dt, i+546) [6];
		PPBO3 = Column (dt, i+546) [8];
		PPBO4 = Column (dt, i+546) [9];

		PVAL1 = CHAR (format(P1, "PValue"));
		PVAL2 = CHAR (format(P2, "PValue"));
		PVAL3 = CHAR (format(P3, "PValue"));
		PVAL4 = CHAR (format(P4, "PValue"));
		PVAL5 = CHAR (format(P5, "PValue"));
		PVAL6 = CHAR (format(P6, "PValue"));
	
		gbx = substitute (Name Expr (gbe), 	Expr (_YS_), YCOL,
										Expr (_STE_), STDE,
										Expr (_TPY1_), 1,
										Expr (_TPY2_), 1,
										Expr (_TPY3_), 1,
										Expr (_BPY_), -1,
										Expr (_LNAME_), LABEL,
										Expr (_P1_), PVAL1,
										Expr (_P2_), PVAL2,
										Expr (_P3_), PVAL3,
										Expr (_P4_), PVAL4,
										Expr (_P5_), PVAL5,
										Expr (_P6_), PVAL6
										);
	
		gb = Eval (gbx);
		
		gbr = gb << report;
		
		YAxis = gbr [Axis Box (2)];
		YMax = YAxis << Get Max;
		YMin = YAxis << Get Min;
		
		gbr << close window;
		
		YRange = ABS (YMax - YMin);
		
		While (YRange <= 1.0,
			
			YMax = YMax + (YRange * 0.1);
			YMin = YMin - (YRange * 0.1);
			YRange = abs (YMax - YMin);
		);
		
		YMax = YMax + (YRange * 0.15);
		TOPY1 = YMax - (YRange * 0.1);
		TOPY2 = YMax - (YRange * 0.18);
		TOPY3 = YMax - (YRange * 0.26);
		BOTY = YMin + (YRange *0.1);
		
		gbx = substitute (Name Expr (gbe), 	Expr (_YS_), YCOL,
										Expr (_STE_), STDE,
										Expr (_TPY1_), TOPY1,
										Expr (_TPY2_), TOPY2,
										Expr (_TPY3_), TOPY3,
										Expr (_BPY_), BOTY,
										Expr (_LNAME_), LABEL,
										Expr (_P1_), PVAL1,
										Expr (_P2_), PVAL2,
										Expr (_P3_), PVAL3,
										Expr (_P4_), PVAL4,
										Expr (_P5_), PVAL5,
										Expr (_P6_), PVAL6
										);

	
	
		gb = Eval (gbx);
	
		gbr = gb << report;
		
		YAxis = gbr [Axis Box (2)];
		
		YAxis << Max (YMax);
		YAxis << Min (YMin);
		YAxis << Inc (round (YRange/9, 1));
		
		gbr << Set Title (LABEL);
		gbr [TextEditBox (1)] << Set text (LABEL);
		gbr [LegendBox (1)] << delete;

		
		fb = gbr [FrameBox (1)];
		
		if(	Minimum (P1, P2, P3, P4, P5, P6)<= 0.01 & 
			Maximum (	abs (YCOL[2]), abs (YCOL[3]), abs (YCOL[5]), abs (YCOL[6]),	abs (YCOL[8]), abs (YCOL[9]))>=0.2 &
			Minimum (PPBO1, PPBO2, PPBO3, PPBO4) <= 0.01, 
			mylbox << append (fb),.);
		
		gbr << close window;
	
);

New Window ("OUTPUT", mylbox);

Now, instead of writing the P Values / FDR onto the plots (see PVALs inserted as Text elements in the Graphics Script), I would like to append a summary table with these P Values / FDR below each plot. I have looked into the "Add Table" command but I'm not sure that it provides the formatting flexibility I need and therefore, I would like to learn if there is an alternate way to draw tables with more flexibility.

Any ideas, hints, or recommendations would be greatly appreciated.

Thanks,

TS

Thierry R. Sornasse
1 ACCEPTED SOLUTION

Accepted Solutions
ih
Super User (Alumni) ih
Super User (Alumni)

Re: Add Summary Table at Bottom of Plots in Graph Builder > Multi Panel Aggregated Plots?

Maybe consider constructing a Table Box with a combination of NumberColBox and StringColBox columns? You can even let users enter data right in those tables with NumberColEditBox.

 

You have quite a bit of control over formatting, including recreating many tables found in JMP platforms:

 

ih_0-1622580098002.png

 

View solution in original post

1 REPLY 1
ih
Super User (Alumni) ih
Super User (Alumni)

Re: Add Summary Table at Bottom of Plots in Graph Builder > Multi Panel Aggregated Plots?

Maybe consider constructing a Table Box with a combination of NumberColBox and StringColBox columns? You can even let users enter data right in those tables with NumberColEditBox.

 

You have quite a bit of control over formatting, including recreating many tables found in JMP platforms:

 

ih_0-1622580098002.png