<?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: How to remove Points or Smooth Legend for Graph Builder using JSL? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-remove-Points-or-Smooth-Legend-for-Graph-Builder-using/m-p/85557#M38245</link>
    <description>&lt;P&gt;I believe that your function had an issue with what it was returning.&amp;nbsp; Your "plotout" element was being defined withing the function as:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;plotout=Lineup Box(N Col(listin[1]),);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This is a completed object, which contains an empty lineup box.&amp;nbsp; Nothing else in the function adds to it.&amp;nbsp; However, it is the element that you specify that should be returned from the function.&amp;nbsp; The script below will generate the plots you want.&amp;nbsp; Please note the simple change in the function, that incorporates the Graph Builder code inside of the Lineup Box()&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

dgbplot = Function( {listin, grp, ovl},
	{plotout},
	plotout = Lineup Box( N Col( listin[1] ),
		For( i = 5, i &amp;lt;= N Items( listin ), i++,
			gb = Graph Builder(
				Size( Eval( listin[2] ), Eval( listin[3] ) ),
				Show Control Panel( 0 ),
				Variables(
					X( Column( Eval( listin[4] ) ) ),
					Y( Column( Eval( listin[i] ) ) ),
					Group X( Column( grp ) ),
					Overlay( Column( ovl ) )
				),
				Elements( Points( X, Y ), Smoother( X, Y, Legend( 0 ), Lambda( 5 ) ) )
			// uncomment the lines below to remove smoother legend and keep points
			/*,SendToReport(
				Dispatch(
					{},
					"400",
					LegendBox,
					{Legend Position( {2, [0, 1], 1, [-1, -1]} ), Position( {0, 1, -1, -1} )}
				)
			)*/
			);
			gbr = gb &amp;lt;&amp;lt; report;
		)
	);
	plotout;
);

listin = {1, 960, 300, "weight", "height"};

nw = New Window( "test", vlb = V List Box() );
myplot = dgbplot( listin, "sex", "sex" );

vlb &amp;lt;&amp;lt; append( myplot );&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 12 Dec 2018 10:37:21 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2018-12-12T10:37:21Z</dc:date>
    <item>
      <title>How to remove Points or Smooth Legend for Graph Builder using JSL?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-remove-Points-or-Smooth-Legend-for-Graph-Builder-using/m-p/85527#M38242</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;By default if there are points and smoothing line in Graph Builder, there are legends for both. Sometimes, having two legends is redundant and I would like to get rid of one. What is the syntax for this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I made a graph builder function (see below). But I can't seem to remove the Legend even if I put Legend (0) in Points.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;//Variable //Definition
 //listin ==&amp;gt; list object which contains the following arguments:
 //1. Ncol for Line Up Box output
 //2. Frame size length
 //3. Frame size height
 //4. X axis column
// 5+. Y axis columns
// grp ==&amp;gt; grouping variable for X
//ovl ==&amp;gt; grouping variable for overlay (fitting)
// plotout ==&amp;gt; line up box object output

dgbplot = Function({listin,grp,ovl},{plotout},
                  plotout=Lineup Box(N Col(listin[1]),);
                  For (i=5, i&amp;lt;=Nitems(listin), i++,
                       gb = Graph Builder(
                                          Size( Eval(listin[2]), Eval(listin[3]) ),
                                          Show Control Panel( 0 ),
                                          Variables(
                                                     X( Column(Eval(listin[4]))),
                                                     Y( Column(Eval(listin[i]))),
                                                     Group X(Column(grp)),
                                                     Overlay(Column(ovl))
                                                    ),
                                          Elements( Points( X, Y ), Smoother( X, Y, Legend(0), Lambda(5))),
                                        );
                        gbr = gb &amp;lt;&amp;lt; report;

                        );
                    plotout;
                   );&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;On the other hand, I tried making some "trial" script and it does what I want. I can't understand why.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
Graph Builder(
	Size( 960, 300 ),
	Show Control Panel( 0 ),
	Variables(
		X( :weight ),
		Y( :height ),
		Group X( :sex ),
		Overlay( :sex )
	),
	Elements(
		Points( X, Y, ),
		Smoother( X, Y, Lambda( 5 ) )
	)
)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Shaira&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Dec 2018 07:59:07 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-remove-Points-or-Smooth-Legend-for-Graph-Builder-using/m-p/85527#M38242</guid>
      <dc:creator>shaira</dc:creator>
      <dc:date>2018-12-12T07:59:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove Points or Smooth Legend for Graph Builder using JSL?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-remove-Points-or-Smooth-Legend-for-Graph-Builder-using/m-p/85557#M38245</link>
      <description>&lt;P&gt;I believe that your function had an issue with what it was returning.&amp;nbsp; Your "plotout" element was being defined withing the function as:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;plotout=Lineup Box(N Col(listin[1]),);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This is a completed object, which contains an empty lineup box.&amp;nbsp; Nothing else in the function adds to it.&amp;nbsp; However, it is the element that you specify that should be returned from the function.&amp;nbsp; The script below will generate the plots you want.&amp;nbsp; Please note the simple change in the function, that incorporates the Graph Builder code inside of the Lineup Box()&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

dgbplot = Function( {listin, grp, ovl},
	{plotout},
	plotout = Lineup Box( N Col( listin[1] ),
		For( i = 5, i &amp;lt;= N Items( listin ), i++,
			gb = Graph Builder(
				Size( Eval( listin[2] ), Eval( listin[3] ) ),
				Show Control Panel( 0 ),
				Variables(
					X( Column( Eval( listin[4] ) ) ),
					Y( Column( Eval( listin[i] ) ) ),
					Group X( Column( grp ) ),
					Overlay( Column( ovl ) )
				),
				Elements( Points( X, Y ), Smoother( X, Y, Legend( 0 ), Lambda( 5 ) ) )
			// uncomment the lines below to remove smoother legend and keep points
			/*,SendToReport(
				Dispatch(
					{},
					"400",
					LegendBox,
					{Legend Position( {2, [0, 1], 1, [-1, -1]} ), Position( {0, 1, -1, -1} )}
				)
			)*/
			);
			gbr = gb &amp;lt;&amp;lt; report;
		)
	);
	plotout;
);

listin = {1, 960, 300, "weight", "height"};

nw = New Window( "test", vlb = V List Box() );
myplot = dgbplot( listin, "sex", "sex" );

vlb &amp;lt;&amp;lt; append( myplot );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Dec 2018 10:37:21 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-remove-Points-or-Smooth-Legend-for-Graph-Builder-using/m-p/85557#M38245</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2018-12-12T10:37:21Z</dc:date>
    </item>
  </channel>
</rss>

