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

Listbox Graphs

I would like to get a listbox plot similar to the script below but with  a different data format. My data looks more like the following table where all of the data to plot is in the first two columns. I want the list portion in the list box to be test count, and when I click on a test count, it produces a plot for both forward and reverse. It looks like it may be possible with a bivariate plot using the by input... Bivariate(I1,V1,By Sweep Type, By Test Count).

 

Is this possible and could I get some guidance on how to get this working. I am a JMP newbie and I'm not entirely sure where to start.

 

My Data Format

V1I1Test CountSweep Type
001Forward
1.11Forward
2.21Forward
001Reverse
-1-.11Reverse
-2-.21Reverse
002Forward
1.12Forward
2.22Forward

 

Listbox Example from sample data

// Listbox_Graphs.jsl
// Display one graph at a time using a listbox to select which one
names default to here(1);

dt    = open("$sample_data\CrimeData.jmp", invisible); 
xcol  = "Year";
ycols = {"Population", "Total Rate", "Violent Rate", "Property Rate", "Murder Rate",
"Rape Rate", "Robbery Rate", "Agg-Aslt Rate", "Burglary Rate", "Larceny Rate",
"MVTheft Rate", "Murder", "Rape", "Robbery", "Agg-Aslt", "Burglary", "Larceny",
"MVTheft", "Total", "Violent", "Property", "Latitude", "Longitude"};

gb_expr = {};
for(i = 1, i <= nitems(ycols), i++,
	ycol = ycols[i];
// Define an array of graph builder expressions, one for each y column
	one_expr = evalinsert(
"\[gb_expr[^i^] = expr(
		dt << Graph Builder(
			Show Control Panel( 0 ),
			Variables( X( :Name( "^xcol^" ) ), Y( :Name( "^ycol^" ) ) ),
			Elements( Points( X, Y, Legend( 5 ) ), Smoother( X, Y, Legend( 6 ) ) )
		),
	);
]\");


	eval(parse(one_expr));
);

// Code to run when a different y variable is selected
y_list_expr = expr(
	y_mtx = y_lb << get selected indices;
	y_i   = y_mtx[1];
	hlb << delete;
	vlb << append(
		hlb = hlistbox(
			eval(gb_expr[y_i])
		)
	);
);

gw = new window("Graphical Output",
	hlistbox(
		panel box(
			xcol || " vs:",
			y_lb = list box(ycols,
				width(250),
				nlines(20),
				max selected(1),
				y_list_expr,
			)
		),
		panel box("Graph",
			vlb = vlistbox(
				hlb = hlistbox(
					eval(gb_expr[1]),
				)
			)
		)
	)
);

y_lb << set selected(1);

 

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Listbox Graphs

Maybe using Local Data Filter would be enough? Change Test Count modeling type to Ordinal or Nominal and then you can get something like this:

jthi_0-1658163784582.png

Script created by JMP:

Graph Builder(
	Size(536, 491),
	Show Control Panel(0),
	Variables(X(:V1), Y(:I1), Group X(:Test Count), Group X(:Sweep Type)),
	Elements(Points(X, Y, Legend(46)), Smoother(X, Y, Legend(47))),
	Local Data Filter(
		Add Filter(
			columns(:Test Count),
			Where(:Test Count == 1),
			Display(:Test Count, N Items(2), "List Display")
		)
	)
)

 Edit:

Script with example data table

View more...
Names Default To Here(1);

dt_example = New Table("Untitled",
	Add Rows(9),
	New Column("V1", Numeric, "Continuous", Format("Best", 12), Set Values([0, 1, 2, 0, -1, -2, 0, 1, 2])),
	New Column("I1", Numeric, "Continuous", Format("Best", 12), Set Values([0, 0.1, 0.2, 0, -0.1, -0.2, 0, 0.1, 0.2])),
	New Column("Test Count", Numeric, "Continuous", Format("Best", 12), Set Values([1, 1, 1, 1, 1, 1, 2, 2, 2])),
	New Column("Sweep Type",
		Character(16),
		"Nominal",
		Set Values({"Forward", "Forward", "Forward", "Reverse", "Reverse", "Reverse", "Forward", "Forward", "Forward"})
	)
);

gb = dt_example << Graph Builder(
	Size(536, 491),
	Show Control Panel(0),
	Variables(X(:V1), Y(:I1), Group X(:Test Count), Group X(:Sweep Type)),
	Elements(Points(X, Y, Legend(46)), Smoother(X, Y, Legend(47))),
	Local Data Filter(
		Add Filter(
			columns(:Test Count),
			Modeling Type(:Test Count, Nominal),
			Display(:Test Count, N Items(2), "List Display")
		)
	)
);
-Jarmo

View solution in original post

6 REPLIES 6
jthi
Super User

Re: Listbox Graphs

Maybe using Local Data Filter would be enough? Change Test Count modeling type to Ordinal or Nominal and then you can get something like this:

jthi_0-1658163784582.png

Script created by JMP:

Graph Builder(
	Size(536, 491),
	Show Control Panel(0),
	Variables(X(:V1), Y(:I1), Group X(:Test Count), Group X(:Sweep Type)),
	Elements(Points(X, Y, Legend(46)), Smoother(X, Y, Legend(47))),
	Local Data Filter(
		Add Filter(
			columns(:Test Count),
			Where(:Test Count == 1),
			Display(:Test Count, N Items(2), "List Display")
		)
	)
)

 Edit:

Script with example data table

View more...
Names Default To Here(1);

dt_example = New Table("Untitled",
	Add Rows(9),
	New Column("V1", Numeric, "Continuous", Format("Best", 12), Set Values([0, 1, 2, 0, -1, -2, 0, 1, 2])),
	New Column("I1", Numeric, "Continuous", Format("Best", 12), Set Values([0, 0.1, 0.2, 0, -0.1, -0.2, 0, 0.1, 0.2])),
	New Column("Test Count", Numeric, "Continuous", Format("Best", 12), Set Values([1, 1, 1, 1, 1, 1, 2, 2, 2])),
	New Column("Sweep Type",
		Character(16),
		"Nominal",
		Set Values({"Forward", "Forward", "Forward", "Reverse", "Reverse", "Reverse", "Forward", "Forward", "Forward"})
	)
);

gb = dt_example << Graph Builder(
	Size(536, 491),
	Show Control Panel(0),
	Variables(X(:V1), Y(:I1), Group X(:Test Count), Group X(:Sweep Type)),
	Elements(Points(X, Y, Legend(46)), Smoother(X, Y, Legend(47))),
	Local Data Filter(
		Add Filter(
			columns(:Test Count),
			Modeling Type(:Test Count, Nominal),
			Display(:Test Count, N Items(2), "List Display")
		)
	)
);
-Jarmo
trevorphysics
Level II

Re: Listbox Graphs

This may work. Is there a way to split up the axis? The real data has a much larger range of voltages and currents

 

Functionally this is a great start. Thanks for your help!

jthi
Super User

Re: Listbox Graphs

I'm not sure what you mean by splitting the axis. You could possibly create new column with additional grouping and use that as other local data filter or for example as Page

-Jarmo
trevorphysics
Level II

Re: Listbox Graphs

Setting it as a different page worked perfectly. Thank you!

trevorphysics
Level II

Re: Listbox Graphs

Edit: Posted the comment twice. Apologies.
txnelson
Super User

Re: Listbox Graphs

You may also want to look into using the Response Screening Platform.  It generates a summary data table that has the analysis results in significance order.  Selection of the 1 or more of the parameters, and then running one of the provided Table Scripts produces the scatterplots using Fit Y by X.  Therefore, all of the analytical tests available in Fit Y by X are available to the selected parameters.

Names Default To Here( 1 );
dt = Current Data Table();

Response Screening( 
	Y( :V1, :I1 ), 
	X( :Test Count, :Sweep Type ), 
	PValues Table on Launch( 1 ) 
	);

txnelson_0-1658166523135.png

 

Jim