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
matth1
Level IV

Change Graph Builder line widths with overlay variable

I want to be able to change line widths in Graph Builder when I have an overlay variable specified but I don’t know upfront what the values of that variable might be (or how many values there may be). I’ve tried the following based on a community post:

 

Names Default To Here(1);
Open("$SAMPLE_DATA/Big Class.jmp");
gb = Graph Builder(
      Size( 534, 454 ),
      Show Control Panel( 0 ),
      Variables( X( :height ), Y( :weight ), Overlay( :sex ) ),
      Elements( Points( X, Y, Legend( 3 ) ), Line( X, Y, Legend( 5 ) ) )
);  
fbs = gb << XPath("//FrameBox");
For(i = 1, i <= N Items(fbs), i++,
      frame = fbs[i];
      seg = (frame << Find Seg("Line Seg"));
      seg << Set Line Width(1);    
);

But this only changes the thickness of one of the lines (in this case, for :sex=="F").

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Change Graph Builder line widths with overlay variable

Hi Matthew,

 

The simple fix is to simply change Find Seg into Find Segs. This will find all the line segments (there are two, one for each sex) and replace the width to what you need.

 

Furthermore, because there’s only 1 frame box (or 1 graph), we do not need the For loop here. I found the community post you were referring to, and in that example, there are two frame boxes.

 

So we can simplify your code as follows:

Names Default To Here(1);
Open("$SAMPLE_DATA/Big Class.jmp");
gb = Graph Builder(
      Size( 534, 454 ),
      Show Control Panel( 0 ),
      Variables( X( :height ), Y( :weight ), Overlay( :sex ) ),
      Elements( Points( X, Y, Legend( 3 ) ), Line( X, Y, Legend( 5 ) ) )
);
      
fbs = gb << XPath("//FrameBox");
      seg = (fbs << Find Segs("Line Seg"));
      seg << Set Line Width(1);

Hope this helps!

View solution in original post

2 REPLIES 2

Re: Change Graph Builder line widths with overlay variable

Hi Matthew,

 

The simple fix is to simply change Find Seg into Find Segs. This will find all the line segments (there are two, one for each sex) and replace the width to what you need.

 

Furthermore, because there’s only 1 frame box (or 1 graph), we do not need the For loop here. I found the community post you were referring to, and in that example, there are two frame boxes.

 

So we can simplify your code as follows:

Names Default To Here(1);
Open("$SAMPLE_DATA/Big Class.jmp");
gb = Graph Builder(
      Size( 534, 454 ),
      Show Control Panel( 0 ),
      Variables( X( :height ), Y( :weight ), Overlay( :sex ) ),
      Elements( Points( X, Y, Legend( 3 ) ), Line( X, Y, Legend( 5 ) ) )
);
      
fbs = gb << XPath("//FrameBox");
      seg = (fbs << Find Segs("Line Seg"));
      seg << Set Line Width(1);

Hope this helps!

hogi
Level XII

Re: Change Graph Builder line widths with overlay variable

Find Segs

such a useful function! is there any documentation?