## script to automatically change Y-variable on graph to a different variable

Occasional Contributor

Joined:

Nov 2, 2016

Hello.  I would like to be able to send my graph (a simple scatterplot made in graph builder) a scripted message that would automatically change the current Y-variable to a different variable.   I don't really want to redo the graph because of several "bells and whistles" that are already part of the script.   I know that column switcher is a great way to present a dialog box of options to the user, but really just want it done automatically in  a single step.   Any advice is appreciated... Thanks, Jim

1 ACCEPTED SOLUTION

Accepted Solutions

Super User

Joined:

Jun 22, 2012

Solution

Here is an example of how to do this with a Graph Builder Scatterplot:

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\big class.jmp" ); gb = Graph Builder( Size( 587, 495 ), Variables( X( :age ), Y( :height ) ), Elements( Points( X, Y, Legend( 6 ) ) ) ); Wait( 4 ); ColumnSwitcherObject = gb << Column Switcher( :height, {:weight} ); ColumnSwitcherObject << Next; ColumnSwitcherObject << run; ColumnSwitcherObject << remove column switcher; Jim 2 REPLIES Super User Joined: Jun 22, 2012 Solution Here is an example of how to do this with a Graph Builder Scatterplot: Names Default To Here( 1 ); dt = Open( "$SAMPLE_DATA\big class.jmp" );
gb = Graph Builder(
Size( 587, 495 ),
Variables( X( :age ), Y( :height ) ),
Elements( Points( X, Y, Legend( 6 ) ) )
);

Wait( 4 );

ColumnSwitcherObject = gb << Column Switcher( :height, {:weight} );
ColumnSwitcherObject << Next;
ColumnSwitcherObject << run;
ColumnSwitcherObject << remove column switcher;
Jim

Occasional Contributor

Joined:

Nov 2, 2016

Thank you so very much!  That worked and saved me a ton of time (assumming I could have ever figured that out).  Happy holidays....