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
breino
Level II

How can I set the orientation of the labels in the horizontal axis of the distribution histogram to be perpendicular to all the histograms?

I am trying to change the orientation of the labels and the format (Engineering SI) for the horizontal axis in the Distribution (histograms) plots. I can do it for the first one using a dispatch statement within the expression that I am building but I need to be able to do it for all of the histograms in the column list.

I tried inserting different types of calls to the column name between the "{}" in:

Dispatch( {},

but none cause the histograms to change. It works if I literally put the column name (i.e. {"My Column"}) only but I want it to do it for all names in the colList array.

 

dt = currentdatatable();

col = dt << get column names();
nc = N Items( col );
colList = {};
bin_width={};

For( i = 1, i <= nc, i++,
	If(Contains (col[i],"::"),
	Insert Into( colList, col[i] ))
);


For(i = 1, i <= N Items(colList), i++,
	Insert Into(bin_width,0.0);
	bin_width[i] = Col Max(Column(dt, colList[i])) - Col Min(Column(dt, colList[i]));
	bin_width[i] = bin_width[i]/10;
);


theExpr = "dis = dt << Distribution(Stack( 1 ),
	Continuous Distribution( column( column(dt,colList[1])), Set Bin Width(bin_width[1]), Label Row( Label Orientation( \!"Perpendicular\!" ) ))
	";

For( i = 2, i < N Items( colList ), i++,
	theExpr = theExpr || ", Continuous Distribution( column( column(dt, colList[" || Char( i ) || "])), Set Bin Width(bin_width[i]))"
);


theExpr = theExpr || ",
	SendToReport(
		Dispatch(
			{},
			\!"1\!",
			ScaleBox,
			{Format( \!"Engineering SI\!", 10 ), Minor Ticks( 0 ),
			Label Row( Label Orientation( \!"Perpendicular\!" ) )}
		)
);";

Eval( Parse( theExpr ) );
1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: How can I set the orientation of the labels in the horizontal axis of the distribution histogram to be perpendicular to all the histograms?

Here is the approach I would take

dt = currentdatatable();

col = dt << get column names();
nc = N Items( col );
colList = {};
bin_width={};

For( i = 1, i <= nc, i++,
	If(Contains (col[i],"::"),
	Insert Into( colList, col[i] ))
);

For(i = 1, i <= N Items(colList), i++,
	Insert Into(bin_width,0.0);
	bin_width[i] = Col Max(Column(dt, colList[i])) - Col Min(Column(dt, colList[i]));
	bin_width[i] = bin_width[i]/10;
);


theExpr = "dis = dt << Distribution(Stack( 1 ),
	Continuous Distribution( column( column(dt,colList[1])), Set Bin Width(bin_width[1]), Label Row( Label Orientation( \!"Perpendicular\!" ) ))
	";

For( i = 1, i < N Items( colList ), i++,
	theExpr = theExpr || ", Continuous Distribution( column( column(dt, colList[" || Char( i ) || "])), Set Bin Width(bin_width[i]))"
);

Eval( Parse( theExpr ) );

(dis << xpath("//AxisBox")) << format("Engineering SI", 10);
(dis << xpath("//AxisBox")) << Minor Ticks( 0 );
(dis << xpath("//AxisBox")) << Label Row( Label Orientation( "Perpendicular" ));

Jim

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: How can I set the orientation of the labels in the horizontal axis of the distribution histogram to be perpendicular to all the histograms?

Here is the approach I would take

dt = currentdatatable();

col = dt << get column names();
nc = N Items( col );
colList = {};
bin_width={};

For( i = 1, i <= nc, i++,
	If(Contains (col[i],"::"),
	Insert Into( colList, col[i] ))
);

For(i = 1, i <= N Items(colList), i++,
	Insert Into(bin_width,0.0);
	bin_width[i] = Col Max(Column(dt, colList[i])) - Col Min(Column(dt, colList[i]));
	bin_width[i] = bin_width[i]/10;
);


theExpr = "dis = dt << Distribution(Stack( 1 ),
	Continuous Distribution( column( column(dt,colList[1])), Set Bin Width(bin_width[1]), Label Row( Label Orientation( \!"Perpendicular\!" ) ))
	";

For( i = 1, i < N Items( colList ), i++,
	theExpr = theExpr || ", Continuous Distribution( column( column(dt, colList[" || Char( i ) || "])), Set Bin Width(bin_width[i]))"
);

Eval( Parse( theExpr ) );

(dis << xpath("//AxisBox")) << format("Engineering SI", 10);
(dis << xpath("//AxisBox")) << Minor Ticks( 0 );
(dis << xpath("//AxisBox")) << Label Row( Label Orientation( "Perpendicular" ));

Jim
breino
Level II

Re: How can I set the orientation of the labels in the horizontal axis of the distribution histogram to be perpendicular to all the histograms?

Thanks Jim that worked perfectly