<?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: Auto exclude a certain item from the legend in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Auto-exclude-a-certain-item-from-the-legend/m-p/663164#M85188</link>
    <description>&lt;P&gt;You want to just hide the marker? Couldn't that cause confusion to the reader as there are markers in the plot but not explanation to them at all?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not sure if there are any very easy ways of doing this besides doing it interactively and then copying the script. Based on JMP created script this looks to be legend item position dependent thing (seems like index starts from 0 here... and index 1 is set to -1 to hide it).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Graph Builder(
	Variables(X(:height), Y(:weight), Color(:sex)),
	Elements(Points(X, Y, Legend(18))),
	SendToReport(Dispatch({}, "400", LegendBox, {Legend Position({18, [0, -1]})}))
)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Here is maybe a bit more robust option using Legend Display (see LegendBox object from scripting index)&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 = dt &amp;lt;&amp;lt; Graph Builder(
	Size(534, 456),
	Show Control Panel(0),
	Variables(X(:height), Y(:weight), Color(:sex)),
	Elements(Points(X, Y, Legend(1)))
);

lgnd = gb &amp;lt;&amp;lt; Get Legend Display;
items = lgnd &amp;lt;&amp;lt; Get Items;

For Each({item}, items, 
	show(item &amp;lt;&amp;lt; get label);
	If(item &amp;lt;&amp;lt; Get Label == "M", 
		item &amp;lt;&amp;lt; Set Visible(0)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 28 Jul 2023 04:36:23 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2023-07-28T04:36:23Z</dc:date>
    <item>
      <title>Auto exclude a certain item from the legend</title>
      <link>https://community.jmp.com/t5/Discussions/Auto-exclude-a-certain-item-from-the-legend/m-p/663091#M85184</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to create a GraphBuilder plot, with a "Flag" column being used in the "Color" section as show below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Kenobi_0-1690487017131.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/55319i6F6D451A415BB392/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Kenobi_0-1690487017131.png" alt="Kenobi_0-1690487017131.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I want my script to autoexclude a particular category, lets say "PASS" in this case. I am not sure on how to do that. Any suggestions would be very helpful&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Kenobi_1-1690487054143.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/55320i5EA95ACBF0DE8230/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Kenobi_1-1690487054143.png" alt="Kenobi_1-1690487054143.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;For(i = 1, i &amp;lt;= N Items(y_cols), i++,

	y_name = Char(y_cols[i]);
	x_name = Char(x_col[1]);

	gb = dt &amp;lt;&amp;lt; Graph Builder(
		Size(700, 350),
		Show Control Panel(0),
		Show Footer(0),
		Variables(X(x_col[1]), Y(y_cols[i]), Color( :Flag )),
		Elements(Points(X, Y, Legend(24))),
		invisible,
		SendToReport(
		Dispatch(
			{},
			"Graph Builder",
			OutlineBox,
			{Set Title( y_name || " vs " || x_name ), Image Export Display( Normal )}
			),
		Dispatch(
			{},
			"Graph Builder",
			FrameBox,
			{Marker Size( 5 ), Transparency(1)}
			),
		Dispatch( 
			{},
			"graph title", 
			TextEditBox, 
			{Set Text( "" )} 
			),
		Dispatch( 
			{}, 
			"X title", 
			TextEditBox, 
			{Set Text( "" )} 
			)
		)
	);
	gb &amp;lt;&amp;lt; Show Legend(1);
	myVLB &amp;lt;&amp;lt; append( Report( gb ) );
	gb &amp;lt;&amp;lt; delete;
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 27 Jul 2023 19:50:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Auto-exclude-a-certain-item-from-the-legend/m-p/663091#M85184</guid>
      <dc:creator>Kenobi</dc:creator>
      <dc:date>2023-07-27T19:50:05Z</dc:date>
    </item>
    <item>
      <title>Re: Auto exclude a certain item from the legend</title>
      <link>https://community.jmp.com/t5/Discussions/Auto-exclude-a-certain-item-from-the-legend/m-p/663164#M85188</link>
      <description>&lt;P&gt;You want to just hide the marker? Couldn't that cause confusion to the reader as there are markers in the plot but not explanation to them at all?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not sure if there are any very easy ways of doing this besides doing it interactively and then copying the script. Based on JMP created script this looks to be legend item position dependent thing (seems like index starts from 0 here... and index 1 is set to -1 to hide it).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Graph Builder(
	Variables(X(:height), Y(:weight), Color(:sex)),
	Elements(Points(X, Y, Legend(18))),
	SendToReport(Dispatch({}, "400", LegendBox, {Legend Position({18, [0, -1]})}))
)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Here is maybe a bit more robust option using Legend Display (see LegendBox object from scripting index)&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 = dt &amp;lt;&amp;lt; Graph Builder(
	Size(534, 456),
	Show Control Panel(0),
	Variables(X(:height), Y(:weight), Color(:sex)),
	Elements(Points(X, Y, Legend(1)))
);

lgnd = gb &amp;lt;&amp;lt; Get Legend Display;
items = lgnd &amp;lt;&amp;lt; Get Items;

For Each({item}, items, 
	show(item &amp;lt;&amp;lt; get label);
	If(item &amp;lt;&amp;lt; Get Label == "M", 
		item &amp;lt;&amp;lt; Set Visible(0)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 28 Jul 2023 04:36:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Auto-exclude-a-certain-item-from-the-legend/m-p/663164#M85188</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-07-28T04:36:23Z</dc:date>
    </item>
    <item>
      <title>Re: Auto exclude a certain item from the legend</title>
      <link>https://community.jmp.com/t5/Discussions/Auto-exclude-a-certain-item-from-the-legend/m-p/664001#M85240</link>
      <description>&lt;P&gt;Thank you very much. This works. I had an additional query. Is it possible to export a custom legend from outside in this script?&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jul 2023 14:01:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Auto-exclude-a-certain-item-from-the-legend/m-p/664001#M85240</guid>
      <dc:creator>Kenobi</dc:creator>
      <dc:date>2023-07-31T14:01:04Z</dc:date>
    </item>
  </channel>
</rss>

