<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Taylor Graph Builder expression in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Taylor-Graph-Builder-expression/m-p/779628#M96085</link>
    <description>&lt;P&gt;I don't usually use substitute for that but rather build them using expressions, below is one option but there are other options&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = Open("$SAMPLE_DATA\Big Class.jmp");

col_lst = cdt &amp;lt;&amp;lt; get column names(Continuous, "String");

var_expr = Expr(Variables(X(:age)));

For Each({colname}, col_lst,
	colname = "height";
	Insert Into(var_expr, EvalExpr(Y(Expr(Name Expr(As Column(dt, colname))))));
);

gb_expr = EvalExpr(
	dt &amp;lt;&amp;lt; Graph Builder(
		Size(534, 450),
		Show Control Panel(0),
		Expr(Name Expr(var_expr))
	);
);

gb = Eval(gb_expr);
// gb &amp;lt;&amp;lt; get script

gb &amp;lt;&amp;lt; Save Script to Data Table("Plot");&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you just want to use Substitute, I think you will have to substitute the whole Variables part (or possibly do some tricks)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

cdt = Open("$SAMPLE_DATA\Big Class.jmp");

col_lst = cdt &amp;lt;&amp;lt; get column names(Continuous, "String");

gb_expr = Expr(
	cdt &amp;lt;&amp;lt; Graph Builder(
		Size(534, 450),
		Show Control Panel(0),
		Variables(X(:age), Y(:height)),
		Elements(Position(1, 1), Points(X, Y, Legend(4))),
		Elements(Position(1, 2), Points(X, Y, Legend(5)))
	)
);

Substitute Into(gb_expr, Expr(Variables(X(:age), Y(:height))), Expr(Variables(X(:age), Y(:height), Y(:weight))));

show(gb_expr);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 06 Aug 2024 15:33:10 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2024-08-06T15:33:10Z</dc:date>
    <item>
      <title>Taylor Graph Builder expression</title>
      <link>https://community.jmp.com/t5/Discussions/Taylor-Graph-Builder-expression/m-p/779486#M96061</link>
      <description>&lt;P&gt;Dear Community,&lt;/P&gt;&lt;P&gt;I would like to make a Graph Builder Script (want to put that as script in a new table) that contains a long list of y vars.&lt;/P&gt;&lt;P&gt;My first approach was to try expression manipulation, but this did not work as expected.&lt;/P&gt;&lt;P&gt;Can anyone please explain what would be a good way to write that script?&lt;/P&gt;&lt;P&gt;The example below also contains my current way, creating the GB instance, and adding y vars afterwards.&lt;/P&gt;&lt;P&gt;Thanks and best regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

cdt = Open( "$SAMPLE_DATA\Big Class.jmp" );

col_lst = cdt &amp;lt;&amp;lt; get column names( Continuous, "String" );

gb_expr = Expr(
	cdt &amp;lt;&amp;lt; Graph Builder(
		Size( 534, 450 ),
		Show Control Panel( 0 ),
		Variables( X( :age ), Y( :height ) ),
		Elements( Position( 1, 1 ), Points( X, Y, Legend( 4 ) ) ),
		Elements( Position( 1, 2 ), Points( X, Y, Legend( 5 ) ) )
	)
);
// this does not work, Expr() does not accept comma separated items
// Substitute Into( gb_expr, Expr( Y( :height ) ), Expr( Y( :height ), Y( :weight ) ) );
// gb_obj = gb_expr;

// this works
// creating GB instance
gb_obj = cdt &amp;lt;&amp;lt; Graph Builder(
	Size( 534, 450 ),
	Show Control Panel( 0 ),
	Variables( X( :age )),
	Elements( Position( 1, 1 ), Points( X, Y, Legend( 4 ) ) ),
	Elements( Position( 1, 2 ), Points( X, Y, Legend( 5 ) ) )
);

// adding Y's
For Each( {ycol}, col_lst, Eval( Parse( Eval Insert( "gb_obj &amp;lt;&amp;lt; variables( Y(:^ycol^ ))" ) ) ) );

// this I would like to create directly, w/o large parse/eval parts, that are bad for maintenance
my_target_expression = gb_obj &amp;lt;&amp;lt; get script();


&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 06 Aug 2024 08:30:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Taylor-Graph-Builder-expression/m-p/779486#M96061</guid>
      <dc:creator>Georg</dc:creator>
      <dc:date>2024-08-06T08:30:30Z</dc:date>
    </item>
    <item>
      <title>Re: Taylor Graph Builder expression</title>
      <link>https://community.jmp.com/t5/Discussions/Taylor-Graph-Builder-expression/m-p/779520#M96063</link>
      <description>&lt;P&gt;Might this minor change to use Eval(Eval Expr()) provide you with what you want&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

cdt = Open( "$SAMPLE_DATA\Big Class.jmp" );

col_lst = cdt &amp;lt;&amp;lt; get column names( Continuous, "String" );

gb_expr = Expr(
	cdt &amp;lt;&amp;lt; Graph Builder(
		Size( 534, 450 ),
		Show Control Panel( 0 ),
		Variables( X( :age ), Y( :height ) ),
		Elements( Position( 1, 1 ), Points( X, Y, Legend( 4 ) ) ),
		Elements( Position( 1, 2 ), Points( X, Y, Legend( 5 ) ) )
	)
);
// this does not work, Expr() does not accept comma separated items
// Substitute Into( gb_expr, Expr( Y( :height ) ), Expr( Y( :height ), Y( :weight ) ) );
// gb_obj = gb_expr;

// this works
// creating GB instance
gb_obj = cdt &amp;lt;&amp;lt; Graph Builder(
	Size( 534, 450 ),
	Show Control Panel( 0 ),
	Variables( X( :age ) ),
	Elements( Position( 1, 1 ), Points( X, Y, Legend( 4 ) ) ),
	Elements( Position( 1, 2 ), Points( X, Y, Legend( 5 ) ) )
);

// adding Y's
For Each( {ycol}, col_lst,
	Eval( Eval Expr( gb_obj &amp;lt;&amp;lt; variables( Y( Expr( ycol ) ) ) ) )
);

// this I would like to create directly, w/o large parse/eval parts, that are bad for maintenance
my_target_expression = gb_obj &amp;lt;&amp;lt; get script();&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 06 Aug 2024 10:12:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Taylor-Graph-Builder-expression/m-p/779520#M96063</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2024-08-06T10:12:31Z</dc:date>
    </item>
    <item>
      <title>Re: Taylor Graph Builder expression</title>
      <link>https://community.jmp.com/t5/Discussions/Taylor-Graph-Builder-expression/m-p/779545#M96067</link>
      <description>&lt;P&gt;Hi Jim,&lt;/P&gt;&lt;P&gt;thanks, this works as well using eval/evalexpr.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But my question was, how could I build that full gb_expr in the upper part,&lt;/P&gt;&lt;P&gt;my showstopper was, that:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Substitute Into( gb_expr, Expr( Y( :height ) ), Expr( Y( :height ), Y( :weight ) ) );&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;did not work.&lt;/P&gt;&lt;P&gt;So I want to substitute many "Y(:c1), Y(:c2) ..." into the Graph Builder expression using expression manipulation (not string manipulation).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Aug 2024 11:30:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Taylor-Graph-Builder-expression/m-p/779545#M96067</guid>
      <dc:creator>Georg</dc:creator>
      <dc:date>2024-08-06T11:30:58Z</dc:date>
    </item>
    <item>
      <title>Re: Taylor Graph Builder expression</title>
      <link>https://community.jmp.com/t5/Discussions/Taylor-Graph-Builder-expression/m-p/779549#M96069</link>
      <description>&lt;P&gt;I am not aware of how to get around the Substitute issue.&amp;nbsp; You may want to explore the Scripting Index Graph Builder messages that can be passed to Graph Builder&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_0-1722946079897.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/66871iEAC60138706E5E86/image-size/medium?v=v2&amp;amp;px=400" role="button" title="txnelson_0-1722946079897.png" alt="txnelson_0-1722946079897.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
gb = Graph Builder(
	Variables( X( :sex ) ),
	Elements( Points( X, Y ), Smoother( X, Y ) )
);
gb &amp;lt;&amp;lt; Add Variable( {:height, Role( "Y" )} );
gb &amp;lt;&amp;lt; Add Variable( {:weight, Role( "Y" )} );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 06 Aug 2024 12:08:26 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Taylor-Graph-Builder-expression/m-p/779549#M96069</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2024-08-06T12:08:26Z</dc:date>
    </item>
    <item>
      <title>Re: Taylor Graph Builder expression</title>
      <link>https://community.jmp.com/t5/Discussions/Taylor-Graph-Builder-expression/m-p/779551#M96071</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/9474"&gt;@Georg&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Building on&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;'s suggestion about sending messages to graph builder, this might get you closer to what you are looking for:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
cdt = Open( "$SAMPLE_DATA/Big Class.jmp" );

col_lst = cdt &amp;lt;&amp;lt; get column names( Continuous, "String" );

gb = Graph Builder(
	Variables( X( :age ) ),
	Elements( Points( X, Y ) )
);

for each( { yCol }, col_lst,
	gb &amp;lt;&amp;lt; Add Variable( { eval( yCol ), Role( "Y" ) } );
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The resulting graph builder script is:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Graph Builder(&lt;BR /&gt;Variables( X( :age ), Y( :height ), Y( :weight ) ),&lt;BR /&gt;Elements( Position( 1, 1 ), Points( X, Y, Legend( 1 ) ) ),&lt;BR /&gt;Elements( Position( 1, 2 ), Points( X, Y, Legend( 2 ) ) )&lt;BR /&gt;);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 06 Aug 2024 12:26:55 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Taylor-Graph-Builder-expression/m-p/779551#M96071</guid>
      <dc:creator>scott_allen</dc:creator>
      <dc:date>2024-08-06T12:26:55Z</dc:date>
    </item>
    <item>
      <title>Re: Taylor Graph Builder expression</title>
      <link>https://community.jmp.com/t5/Discussions/Taylor-Graph-Builder-expression/m-p/779552#M96072</link>
      <description>&lt;P&gt;Thanks to all, that looks good!&lt;/P&gt;</description>
      <pubDate>Tue, 06 Aug 2024 12:30:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Taylor-Graph-Builder-expression/m-p/779552#M96072</guid>
      <dc:creator>Georg</dc:creator>
      <dc:date>2024-08-06T12:30:31Z</dc:date>
    </item>
    <item>
      <title>Re: Taylor Graph Builder expression</title>
      <link>https://community.jmp.com/t5/Discussions/Taylor-Graph-Builder-expression/m-p/779628#M96085</link>
      <description>&lt;P&gt;I don't usually use substitute for that but rather build them using expressions, below is one option but there are other options&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = Open("$SAMPLE_DATA\Big Class.jmp");

col_lst = cdt &amp;lt;&amp;lt; get column names(Continuous, "String");

var_expr = Expr(Variables(X(:age)));

For Each({colname}, col_lst,
	colname = "height";
	Insert Into(var_expr, EvalExpr(Y(Expr(Name Expr(As Column(dt, colname))))));
);

gb_expr = EvalExpr(
	dt &amp;lt;&amp;lt; Graph Builder(
		Size(534, 450),
		Show Control Panel(0),
		Expr(Name Expr(var_expr))
	);
);

gb = Eval(gb_expr);
// gb &amp;lt;&amp;lt; get script

gb &amp;lt;&amp;lt; Save Script to Data Table("Plot");&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you just want to use Substitute, I think you will have to substitute the whole Variables part (or possibly do some tricks)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

cdt = Open("$SAMPLE_DATA\Big Class.jmp");

col_lst = cdt &amp;lt;&amp;lt; get column names(Continuous, "String");

gb_expr = Expr(
	cdt &amp;lt;&amp;lt; Graph Builder(
		Size(534, 450),
		Show Control Panel(0),
		Variables(X(:age), Y(:height)),
		Elements(Position(1, 1), Points(X, Y, Legend(4))),
		Elements(Position(1, 2), Points(X, Y, Legend(5)))
	)
);

Substitute Into(gb_expr, Expr(Variables(X(:age), Y(:height))), Expr(Variables(X(:age), Y(:height), Y(:weight))));

show(gb_expr);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 06 Aug 2024 15:33:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Taylor-Graph-Builder-expression/m-p/779628#M96085</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-08-06T15:33:10Z</dc:date>
    </item>
  </channel>
</rss>

