Subscribe Bookmark RSS Feed

YvX plot, how to JSL iterate through a column's 'groups'?

saspecvd

Occasional Contributor

Joined:

Dec 29, 2016

SO a bit lost here, trying to figure out JSL on my own.  Can you advise on how I would create a generic JSL script that can plot a simple Fit YvX plot that iterates through the various "GroupBy's" in a column?

 

For example, Fit Y b X: 

Y, response = Value

X, Factor = TimeStamp

By = GroupBy1,  GroupBy2

this results in a series of charts grouped by all the unique groups of the two columns.  I then right clicked the first chart and set the legend to be = ColHeader3

 

This first chart is how I want all future charts to look.  I found the script for it but not sure how I can get it to iterate through all the subgroups of each "GroupBy#" column.

 

Ideally, I would open a fresh, unique data table (as long as the headers are all the same) and be able to run this script and get the same format of charts each time, letting it be generic.  

 

Advise?

 

//the script from the Fit Y by X first chart.
Bivariate(
SendToByGroup( Bygroup Default ),
Y( :Value),
X( :TimeStamp),
By( :GroupBy1, :GroupBy2),
SendToByGroup(
{:GroupBy1 == "GroupBy1.1", :GroupBy2== "GroupBy2.1"},
SendToReport(
Dispatch(
{"Bivariate Fit of Value By TimeStamp GroupBy1 =GroupBy1.1"},
"Bivar Plot",
FrameBox,
{Row Legend(
ColHeader3,
Color( 1 ),
Color Theme( "JMP Default" ),
Marker( 0 ),
Marker Theme( "" ),
Continuous Scale( 0 ),
Reverse Scale( 0 ),
Excluded Rows( 0 )
)}
)
)
)
);
2 REPLIES
txnelson

Super User

Joined:

Jun 22, 2012

If you are running interactively hold down the CNTL key as you select the legend you want, it will be applied to all of the charts for each of the By groups. 

 

If you want a scripting method, here is an example

Bivariate(
	Y( :height ),
	X( :weight ),
	by(:sex),
	SendToReport(
		Dispatch(
			{},
			"Bivar Plot",
			FrameBox,
			{Row Legend(
				:age,
				Color( 1 ),
				Color Theme( "JMP Default" ),
				Marker( 0 ),
				Marker Theme( "" ),
				Continuous Scale( 0 ),
				Reverse Scale( 0 ),
				Excluded Rows( 0 )
			)}
		)
	)
);
Jim
Phil_Brown

Super User

Joined:

Mar 20, 2012

You may want to explore the Graph Builder platform. This is a powerful visualization platform that permits various methods of grouping, coloring and legend options.

PDB