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

Graph Builder, Pie plot : How to keep all the elements of a group when filtering on groups that have a specific element ?

Hi,

I'm looking for help in the Graphic Builder. I am using JMP 16.2.0.

I will use a table with two columns (Recipe, Ingredient) as an example. A recipe is composed of multiple ingredient, and an ingredient can be use in multiple recipes. The table is provided in Attachments.

 

In the Graph Builder, I put Recipe in Group X, Ingredient in X and choose a Pie Plot to see what ingredient is used in which recipe.

CorentinL_0-1734091108408.png

 

What I would like to do is to select an ingredient and it will keep the pie plots of all the recipes that use the ingredient. The pie plots should show all their ingredients .

For example, I want to see all the recipes that use Milk. If I add a local data filter on the recipe, the pie plot won't display all the ingredients for the Bechamel and Pancake.

CorentinL_1-1734091980301.png

 

What I would like to have as an output is something like this : 

CorentinL_2-1734092078306.png

Is there an easy way to do that, without writing some JSL ? We can modify the table or work with the Graph Builder.

 

Thank you !

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Graph Builder, Pie plot : How to keep all the elements of a group when filtering on groups that have a specific element ?

I'm not sure if you can do this in JMP16 (I'm using JMP18), but you can create multiple response column of your Ingredients

jthi_1-1734093419505.png

jthi_2-1734093437248.png

Table attached with table script

-Jarmo

View solution in original post

5 REPLIES 5
jthi
Super User

Re: Graph Builder, Pie plot : How to keep all the elements of a group when filtering on groups that have a specific element ?

I'm not sure if you can do this in JMP16 (I'm using JMP18), but you can create multiple response column of your Ingredients

jthi_1-1734093419505.png

jthi_2-1734093437248.png

Table attached with table script

-Jarmo
CorentinL
Level II

Re: Graph Builder, Pie plot : How to keep all the elements of a group when filtering on groups that have a specific element ?

Thank you for the reply, this is a great solution indeed.

 

Unfortunately, it does not work in JMP 16.

CorentinL_0-1734100355825.png

 

I guess we'll need to update to a more recent version !

jthi
Super User

Re: Graph Builder, Pie plot : How to keep all the elements of a group when filtering on groups that have a specific element ?

Scripting is also an option but you said you wish to avoid it, so here is maybe an option which might work in JMP16 (it can be a bit clunky to use due to utilizing selection row state). If you can use Data filter instead of local data filter, you can do something like this

 

Create formula column like

jthi_4-1734102350448.png

 

Col Sum(Selected(), :Recipe) >= 1

Create Data filter (NOT LOCAL DATA FILTER) with ingredient

 

jthi_1-1734102076749.png

Create your graph WITH local data filter using your newly created formula column and set the value to 1

jthi_2-1734102108838.png

You can then collapse the local data filter and organize the windows side by side

jthi_5-1734102484084.png

One a bit annoying thing here is that there will be a selection and it will mess up if something is selected from the table / outside of data filter.

-Jarmo
txnelson
Super User

Re: Graph Builder, Pie plot : How to keep all the elements of a group when filtering on groups that have a specific element ?

If you modify the data table with new rows and a new column, I can get it to work in JMP 16.  You need to create a new row for each combination of ingredients for each ingredient in the recipe.  So for Bechamel which has Milk, Flour and Butter

txnelson_0-1734103605644.png

it has to be expanded to

txnelson_1-1734103670709.png

txnelson_2-1734103844093.png

And here is a script that will generate the expanded data table

names default to here(1);
dt=current data table();

// Start the new table
dtOut = New Table( "Expanded",
	New Column( "Recipe", Character ),
	New Column( "Ingredient", Character ),
	New Column( "Ingredients", Character )
);

// Find the different Recipies
summarize( dt, Recipies = By(:Recipe));

// Loop through the recipies 
For Each( {rec}, Recipies,
	// Find the ingredients for the current recipe
	dt << select where(:Recipe == rec );
	dtTemp = dt << subset( selected columns(0), selected rows(1));
	summarize( dtTemp, ingre=by(:ingredient));
	
	// Loop across each ingredient and add the rows to the data table
	For Each( {item}, ingre,
		dtTemp << New Column("Ingredients", character, set each value(item));
		dtOut << concatenate( dtTemp, Append to First Table(1) );
		dtTemp << delete columns(:Ingredients);
	);
	close( dtTemp, nosave );
);
Jim
hogi
Level XII

Re: Graph Builder, Pie plot : How to keep all the elements of a group when filtering on groups that have a specific element ?

GraphBuilder + Multiple Response : VERY (!) useful!
it got available with JMP17: New in JMP 17 and JMP Pro 17 - Some Highlights ORIGINAL ENGLISH VERSION 

the upgrade is free of charge. Maybe take 2 steps and get all the great features of JMP18?