cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP 19 is here! See the new features at jmp.com/new.
  • Register to attend Discovery Summit 2025 Online: Early Users Edition, Sept. 24-25.
Choose Language Hide Translation Bar
BabyDoragon
Level II

How to make group X display only certain items.

When using Group X, all sections are cut out in the table. How should I modify the following JSL so that Group X only displays 13 and 16?"

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
Graph Builder(
	Size( 528, 500 ),
	Show Control Panel( 0 ),
	Variables( X( :sex ), X( :age, Position( 1 ) ), Y( :height ), Group X( :age ) ),
	Elements( Points( X( 1 ), X( 2 ), Y, Legend( 10 ) ) )
);

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
jthi
Super User

Re: How to make group X display only certain items.

You could add local data filter if something like this what you are looking for 

jthi_0-1742288489764.png

Graph Builder(
	Size(528, 500),
	Show Control Panel(0),
	Variables(X(:sex), X(:age, Position(1)), Y(:height), Group X(:age)),
	Elements(Points(X(1), X(2), Y, Legend(10))),
	Local Data Filter(
		Add Filter(
			columns(:age),
			Where(:age == {13, 16}),
			Display(:age, N Items(6))
		)
	)
);

Or if you are scripting, you can use Where

Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");

gb = dt << Graph Builder(
	Size(528, 500),
	Show Control Panel(0),
	Variables(X(:sex), X(:age, Position(1)), Y(:height), Group X(:age)),
	Elements(Points(X(1), X(2), Y, Legend(10))),
	Where(Contains({13, 16}, :age))
);
-Jarmo

View solution in original post

txnelson
Super User

Re: How to make group X display only certain items.

Just switch the logic by using not "!"

Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");

gb = dt << Graph Builder(
	Size(528, 500),
	Show Control Panel(0),
	Variables(X(:sex), X(:age, Position(1)), Y(:height), Group X(:age)),
	Elements(Points(X(1), X(2), Y, Legend(10))),
	Where(!Contains({13, 16}, :age))
);
Jim

View solution in original post

3 REPLIES 3
jthi
Super User

Re: How to make group X display only certain items.

You could add local data filter if something like this what you are looking for 

jthi_0-1742288489764.png

Graph Builder(
	Size(528, 500),
	Show Control Panel(0),
	Variables(X(:sex), X(:age, Position(1)), Y(:height), Group X(:age)),
	Elements(Points(X(1), X(2), Y, Legend(10))),
	Local Data Filter(
		Add Filter(
			columns(:age),
			Where(:age == {13, 16}),
			Display(:age, N Items(6))
		)
	)
);

Or if you are scripting, you can use Where

Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");

gb = dt << Graph Builder(
	Size(528, 500),
	Show Control Panel(0),
	Variables(X(:sex), X(:age, Position(1)), Y(:height), Group X(:age)),
	Elements(Points(X(1), X(2), Y, Legend(10))),
	Where(Contains({13, 16}, :age))
);
-Jarmo
BabyDoragon
Level II

Re: How to make group X display only certain items.

In the second method you mentioned, it is a positive list, show only 13 and 16.
However, is it possible to make it a negative list, for example, ignoring 17 in any situation.

txnelson
Super User

Re: How to make group X display only certain items.

Just switch the logic by using not "!"

Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");

gb = dt << Graph Builder(
	Size(528, 500),
	Show Control Panel(0),
	Variables(X(:sex), X(:age, Position(1)), Y(:height), Group X(:age)),
	Elements(Points(X(1), X(2), Y, Legend(10))),
	Where(!Contains({13, 16}, :age))
);
Jim

Recommended Articles