Subscribe Bookmark RSS Feed

Saving Image with Group by Analysis

Hegedus

Community Trekker

Joined:

Jun 23, 2011

Simple little code to produce distributions with a by Group function.  In this case the :Group column has values "A" and "B".  The Saved picture only includes the images for group "B".  How do I get both "A" and "B" saved?

obj110=Distribution(

  Continuous Distribution( Column( :Name( "Min(Zactual_livebug)" ) ) ),

  Continuous Distribution( Column( :Name( "Max(Zactual_livebug)" ) ) ),

  Continuous Distribution( Column( :Name( "Range(Zactual_livebug)" ) ) ),

  By( :Group )

);

obj110<<save picture("110 Group Distributions.jpeg",jpeg);

1 REPLY
Craige_Hales

Staff

Joined:

Mar 21, 2013

obj110 is actually a list of distribution platforms, one per by group:


dt=open("$sample_data/big class.jmp");


obj110=dt << Distribution(


  Continuous Distribution( Column( height ) ),


  Continuous Distribution( Column( weight ) ),


  Continuous Distribution( Column( age ) ),


  By( :sex )


);


obj110<<save picture("$desktop/test.jpg",jpg);


{Distribution[], Distribution[]}

When you send a message to a list, like <<SavePicture, the message is sent to each item in the list, one at a time.  Your output JPG file was actually written several times, and only the last by group was left.

The platforms for each by group are held together by a ListBox.  You can start at the first platform and get the parent, like this:


root = obj110[1]; // get the first platform


root=root<<parent; // get the platform's container


root<<save picture("$desktop/test.jpg",jpg);


This makes one picture with both by groups.  If you want a picture for each by group, loop over nitems(obj110).

Craige