Subscribe Bookmark RSS Feed

Bivariate Graphing with Data Filtering within multiple columns

saswatmishra50

Community Trekker

Joined:

Jun 26, 2015

Hi I would like help on an issue with scripting a bivariate graph with multiple where clauses.

I need to place multiple graphs in one window organized by the Recipe and the legend shows the specific tools.

Currently I have 6 tools under one recipe and I need to plot 3 tools per graph for the same Recipe.

In total I need 2 graphs for 6 tools under 1 recipe.

I have tried combinations of where clauses, data filters with not hope

dt = Open("........")

NewWindow("......",

Bivariate(

  Y( :Column1 ),

  X( :Column2),

  Histogram Borders( 1 ),

  Where(:Recipe == "XXXX" & :Tool == "YYYY" & :Tool == "YYYX & :Tool == "YYXX"),  <---- I need to put in multiple tools and recipes to organize by specific words and it does not work through this. Data filtering will exclude the points on first graph but it will also exclude it for second graph.

 

  SendToReport(Dispatch(

  {},

  "2",

  ScaleBox,

  {Add Ref Line( 140, Solid, "Black", "", 2 ),

  Add Ref Line( 70, Solid, "Black", "", 2 ),

  Add Ref Line( 90, Solid, "Black", "", 2 )}

  ),

  Dispatch(

  {},

  "Bivariate Fit of Value By Date_Time",

  OutlineBox,{Close( 1 ), Set Title( "XXXX" )}

  ),

  Dispatch(

  {},

  "1",

  ScaleBox,

  {Format( "y/m/d h:m:s", ), 

  Interval( "Hour" ), Inc( 2 ), Minor Ticks( 0 ),

  Tick Font( face( "Arial Unicode MS" ), size( 8 ) ), Show Major Grid( 1 ),

  Rotated Labels( "Angled" )}

  ),

  Dispatch(

  {},

  "Bivariate Report",

  FrameBox( 2 ),

  {DispatchSeg(

  HistSeg( 1 ),

  {Fill Color( "BlueCyan" ), Histogram Color( 13 )}

  )}

  ),

  Dispatch( {}, "Bivar Plot", FrameBox, {Frame Size( 1100, 180 )} ),

  Dispatch(

  {},

  "Bivariate Report",

  FrameBox( 4 ),

  {DispatchSeg(

  HistSeg( 1 ),

  {Fill Color( "BlueCyan" ), Histogram Color( 13 )}

  )}

  ),

  

  ),

  Dispatch({},"Bivar Plot", FrameBox,{Frame Size(900,274),Row Legend(Tool),Color(1),Color Theme("JMP Default"),Marker(0),Marker Theme(""),Continous Scale(0),Reverse Scale(0),Excluded Rows(0)})

  ),) << Maximize Window

1 ACCEPTED SOLUTION

Accepted Solutions
Jeff_Perkinson

Community Manager

Joined:

Jun 23, 2011

Solution

Saswat Mishra wrote:



  Where(:Recipe == "XXXX" & :Tool == "YYYY" & :Tool == "YYYX & :Tool == "YYXX"),  <---- I need to put in multiple tools and recipes to organize by specific words and it does not work through this.





You'll need to use | instead of & between your :Tool comparisons. The | operator is for OR and the & operator is AND.

Something like this should work:

Where(:Recipe == "XXXX" & (:Tool == "YYYY" | :Tool == "YYYX | :Tool == "YYXX"))


However, I think PMroz is on to something in his replies. You should be able to use a By() here. Note that you can have multiple columns in the By(). Here's an example:


dt=open("$SAMPLE_DATA\Big Class.jmp");

dt<<Bivariate( Y( :weight ), X( :height ), By( :age, :sex ) );

-Jeff
5 REPLIES
pmroz

Super User

Joined:

Jun 23, 2011

Perhaps you could create a new By variable that holds the various combinations you want to analyze things by.  Use that By variable in the Bivariate platform and you'll get separate plots for each.

saswatmishra50

Community Trekker

Joined:

Jun 26, 2015

I also have multiple recipes within my data table. I want to keep my data table to same without opening multiple others.

I have 3 Recipes which all use the same 6+ tools. But I need to organize it by New window per Recipe or all in the same window it does not matter.

Then the specific tools need to be graphed per recipe with some tools on one graph and the other tools which use the same Recipe on a different graph.

My issue with the By clause is if I do :Recipe then I will receive multiple bivariates which contain all the different tools on the same Recipe graph.

so for instance I have

Tool = { A1_1, A1_2, A1_3, B1_1, B1_2, B1_3}

Recipe = {XXXX, XXXY, XXYY}

Recipe XXXX will put all tools in A1 and B1 together into one graph if I organize with the By(:Recipe == "XXXX")

If I do it By(:Tool) then I will have plots that have Recipes combined together for  XXXX, XXXY, and XXYY as well as a graph for each separate tool A1_1, A1_2, A1_3.

If you mean something else then could you elaborate?

pmroz

Super User

Joined:

Jun 23, 2011

It appears that there is an additional hierarchy to your data that you wish to separate things by.  For example what if you added a column called Tool Type, which is either A or B.  Would that help?

9103_ToolType.png

Jeff_Perkinson

Community Manager

Joined:

Jun 23, 2011

Solution

Saswat Mishra wrote:



  Where(:Recipe == "XXXX" & :Tool == "YYYY" & :Tool == "YYYX & :Tool == "YYXX"),  <---- I need to put in multiple tools and recipes to organize by specific words and it does not work through this.





You'll need to use | instead of & between your :Tool comparisons. The | operator is for OR and the & operator is AND.

Something like this should work:

Where(:Recipe == "XXXX" & (:Tool == "YYYY" | :Tool == "YYYX | :Tool == "YYXX"))


However, I think PMroz is on to something in his replies. You should be able to use a By() here. Note that you can have multiple columns in the By(). Here's an example:


dt=open("$SAMPLE_DATA\Big Class.jmp");

dt<<Bivariate( Y( :weight ), X( :height ), By( :age, :sex ) );

-Jeff
saswatmishra50

Community Trekker

Joined:

Jun 26, 2015

I believe I was not understanding the OR operator correctly. I assumed that the AND operator would incorporate all the options I selected. 1,2,3 into one graph but my outcome was only showing the first option so it would only output the recipe and 1 tool. A_1, A_2, A_3 but only A_1 would output not A_2 or A_3.

The reason why I could not use the By clause was because I had the extra hierarchy like you stated PMroz which was the Tool name (A) and the sub group(1) , A _ 1. When I do both By(:Recipe, :Tool) it would output a graph per tool for each recipe. Which was many more than I would have liked.

Thank You guys so much for all your help jeff.perkinson and PMroz

This helped me perfectly,

Where(:Recipe == "XXXX" & (:Tool == "YYYY" | :Tool == "YYYX | :Tool == "YYXX")