cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
RA899
Level III

Graph Builder: removing empty sub-graphs using JSL

Hi, 

I'm using JSL to produce graph builder plots. These plots are plotted against one or multiple variables. The problem is that sometimes, graph builder produces empty plot with no value. Is there are a method to remove those empty sub-graphs? For a better understanding of the problem, I have attached an example. In the example, ALICE, DAVID, ..etc. have empty plots. Those are the one I'm trying to remove using JSL script. 

 

I'm thinking of using the Empty() OR Is Missing() function to check if a specific cell is empty, don't plot it.

 

My question is that is there are a way to select that specific cell and remove it from the plot ? 

 

Thanks you ! 

 

 

RA899_0-1710787592486.png

 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Graph Builder: removing empty sub-graphs using JSL

The numeric data filter has a Select Missing option that would let you filter without having to convert to names.  This will also show the filter where-clause in Graph Builder, which is really similar to the suggestion of @jthi of directly adding a Where-clause to the Graph Builder launch.  The main advantage of the filter is that you can toggle back and forth.

 

dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt << Graph Builder(
	Size( 857, 534 ),
	Show Control Panel( 0 ),
	Variables( Y( :height ), Group X( :name ) ),
	Elements( Histogram( Y, Legend( 4 ) ) ),
	Local Data Filter(
		Inverse( 1 ),
		Add Filter( columns( :height ), Select Missing( :height ) )
	)
);

View solution in original post

9 REPLIES 9
Byron_JMP
Staff

Re: Graph Builder: removing empty sub-graphs using JSL

at the table level, you might try to select cells that are empty and set them to hidden and excluded

if(is missing()==1...

JMP Systems Engineer, Health and Life Sciences (Pharma)
jthi
Super User

Re: Graph Builder: removing empty sub-graphs using JSL

If you know which values will be empty, you can add Where statement to your Graph Builder message to filter those out. Or you can add hidden local data filter to hide those

-Jarmo
mmarchandTSI
Level V

Re: Graph Builder: removing empty sub-graphs using JSL

I would do it using a local data filter.  You can script this specific example as follows:

 

Names Default To Here( 1 );
dt = Data Table( "Big Class" );
thenames = dt:name[(dt << Get Rows Where( Is Missing( :height ) ))];
Graph Builder(
	Size( 857, 534 ),
	Show Control Panel( 0 ),
	Variables( Y( :height ), Group X( :name ) ),
	Elements( Histogram( Y, Legend( 4 ) ) ),
	Local Data Filter(
		Inverse( 1 ),
		Add Filter(
			columns( :name ),
			Where( :name == thenames ),
			Display( :name, N Items( 15 ), Find( Set Text( "" ) ) )
		)
	)
);

It's also easy to do with the menus in Graph Builder.

 

mmarchandTSI_0-1710795434869.png

 

Re: Graph Builder: removing empty sub-graphs using JSL

The numeric data filter has a Select Missing option that would let you filter without having to convert to names.  This will also show the filter where-clause in Graph Builder, which is really similar to the suggestion of @jthi of directly adding a Where-clause to the Graph Builder launch.  The main advantage of the filter is that you can toggle back and forth.

 

dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt << Graph Builder(
	Size( 857, 534 ),
	Show Control Panel( 0 ),
	Variables( Y( :height ), Group X( :name ) ),
	Elements( Histogram( Y, Legend( 4 ) ) ),
	Local Data Filter(
		Inverse( 1 ),
		Add Filter( columns( :height ), Select Missing( :height ) )
	)
);
hogi
Level XII

Re: Graph Builder: removing empty sub-graphs using JSL

The issue with Inverse(1) and Select Missing:


The Inverse(1) acts on the WHOLE selection of the Data filter, not just on a specific item.

Which means: It's not possible to combine this approach with additional filters.

e.g. NOT possible to select:


- inverse of (missing height values)

- sex = "M"

 

Maybe, in a future release of Jmp (> 18) there will be an option "not" to "invert" individual parts of the data filter:
data filters, new option: "not" 

Byron_JMP
Staff

Re: Graph Builder: removing empty sub-graphs using JSL

That feature is already there.

Instead of using "AND" in the local data filter, use "OR".

 

In this case I have missing height data, and a column with an indicator for missing height.

In the filter I can do this :  Where((sex = F) or (height missing Indicator = 1))

 

Byron_JMP_0-1710851673405.png

 

JMP Systems Engineer, Health and Life Sciences (Pharma)
hogi
Level XII

Re: Graph Builder: removing empty sub-graphs using JSL

Hi @Byron_JMP sorry, the solution doesn't seem to fit to:

 

show me all data points which fulfill:

1)  non-missing data -> inverse of (missing height values)
AND 

2) sex = "M"


maybe with an "inverse" around it ...
one could generate a suitable data filter for this special case - and every user with a PhD in set operation logic will love it.

For a versatile, smooth and easy user interface, I am desperately waiting for the Jmp version with the "not" option - which will allow:

hogi_0-1710866372306.png

 

mmarchandTSI
Level V

Re: Graph Builder: removing empty sub-graphs using JSL

You can always invert the inverted selection.  But I agree with your request here.

 

mmarchandTSI_0-1710866996737.png

 

Byron_JMP
Staff

Re: Graph Builder: removing empty sub-graphs using JSL

the key to making solution work is adding a column with the formula:  is missing(:column name)

this returns a 0 or a 1 in the formula column. 0 = not missing.

 

Indicator columns are your friend.

 

JMP Systems Engineer, Health and Life Sciences (Pharma)