<?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: WINDOWS 10 &amp;gt; JMP 17.2 &amp;gt; Graph Builder &amp;gt; Scatter Plot &amp;gt; Dynamic Cluster Annotation in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/WINDOWS-10-gt-JMP-17-2-gt-Graph-Builder-gt-Scatter-Plot-gt/m-p/825424#M100557</link>
    <description>&lt;P&gt;I think then you will have to utilize graphic script as labels do not have that many customization options (to change the text size you would have to change font preferences).&lt;/P&gt;</description>
    <pubDate>Sun, 29 Dec 2024 07:31:29 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2024-12-29T07:31:29Z</dc:date>
    <item>
      <title>WINDOWS 10 &gt; JMP 17.2 &gt; Graph Builder &gt; Scatter Plot &gt; Dynamic Cluster Annotation</title>
      <link>https://community.jmp.com/t5/Discussions/WINDOWS-10-gt-JMP-17-2-gt-Graph-Builder-gt-Scatter-Plot-gt/m-p/825351#M100541</link>
      <description>&lt;P&gt;Hi JMP Community,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Windows Pro 10 - JMP 17.2&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have some data projected on a 2D UMAP, and I would like to automatically insert the formatted (Color and Size) Cluster ID on top of the UMAP2 x UMAP1 Scatter Plot in Graph Builder. I managed to get the Cluster IDs by plotting them separately and merging them to the main FrameBox. Still, this is unsatisfactory because I cannot control the size and color of those Cluster ID labels.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I experimented with a Loop within an Add Graphics Script() command but could not make it work.&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="Thierry_S_0-1735364165556.png" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/71562i47701FA3E01A12AE/image-size/large?v=v2&amp;amp;px=999" role="button" title="Thierry_S_0-1735364165556.png" alt="Thierry_S_0-1735364165556.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Here is the script I used to produce the plot above&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here(1);

dt = Data Table ("ANNOTATION of 2D CLUSTERS");

dt_sum = dt &amp;lt;&amp;lt; Summary(
	Group( :WARD UMAP CLUSTERS ),
	Mean( :UMAP1 CENTER by CLUSTER ),
	Mean( :UMAP2 CENTER by CLUSTER ),
	Freq( "None" ),
	Weight( "None" ),
	statistics column name format( "column" )
);

gb = dt &amp;lt;&amp;lt; Graph Builder(
				Size( 483, 675 ),
				Fit to Window( "Off" ),
				Page Level Fill Color( "White" ),
				Graph Spacing( 15 ),
				Spacing Borders( 1 ),
				Variables( X( :UMAP1 ), Y( :UMAP2 ), Color( :WARD UMAP CLUSTERS ) ),
				Elements( Points( X, Y, Legend( 27 ) ) )
			);

gbr = report (gb);

main_x_max = gbr [AxisBox(1)] &amp;lt;&amp;lt; Get Max;
main_x_min = gbr [AxisBox(1)] &amp;lt;&amp;lt; Get Min;

main_y_max = gbr [AxisBox(2)] &amp;lt;&amp;lt; Get Max;
main_y_min = gbr [AxisBox(2)] &amp;lt;&amp;lt; Get Min;

F_size = gbr[FrameBox(1)] &amp;lt;&amp;lt; Get Size;

xbe = Expr(dt_sum &amp;lt;&amp;lt; Graph Builder(
			Size( _W_, _H_ ),
			Fit to Window( "Off" ),
			Page Level Fill Color( "White" ),
			Graph Spacing( 15 ),
			Spacing Borders( 1 ),
			Variables(
				X( :UMAP1 CENTER by CLUSTER ),
				Y( :UMAP2 CENTER by CLUSTER ),
				Color( :WARD UMAP CLUSTERS )
			),
			Elements(
				Bar( X, Y, Legend( 4 ), Bar Style( "Float" ), Label( "Label by Row" ) )
			)
		)
	);	
xbx = Substitute(Name Expr (xbe), 	Expr (_W_), F_Size [1],
									Expr (_H_), F_size [2]
);

xb = Eval (xbx);

xbr = report (xb);

xbr [AxisBox (1)] &amp;lt;&amp;lt; max (main_x_max);
xbr [AxisBox (1)] &amp;lt;&amp;lt; min (main_x_min);	

xbr [AxisBox (2)] &amp;lt;&amp;lt; max (main_y_max);
xbr [AxisBox (2)] &amp;lt;&amp;lt; min (main_y_min);

xbr [FrameBox(1)] &amp;lt;&amp;lt; Copy Frame Contents;
gbr [FrameBox(1)] &amp;lt;&amp;lt; Paste Frame Contents;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Thank you.&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;
&lt;P&gt;TS&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 28 Dec 2024 05:46:08 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/WINDOWS-10-gt-JMP-17-2-gt-Graph-Builder-gt-Scatter-Plot-gt/m-p/825351#M100541</guid>
      <dc:creator>Thierry_S</dc:creator>
      <dc:date>2024-12-28T05:46:08Z</dc:date>
    </item>
    <item>
      <title>Re: WINDOWS 10 &gt; JMP 17.2 &gt; Graph Builder &gt; Scatter Plot &gt; Dynamic Cluster Annotation</title>
      <link>https://community.jmp.com/t5/Discussions/WINDOWS-10-gt-JMP-17-2-gt-Graph-Builder-gt-Scatter-Plot-gt/m-p/825364#M100543</link>
      <description>&lt;P&gt;You could add "extra" x and y-axis and then use those. Note that the color has been changed for the Mean(UMAP2) as it cannot be left as default or they will use Value Colors. You can also change the marker size to 0 i you don't want to highlight the "mean" point or change the marker&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1735367411861.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/71564iC660C2E5715831C9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1735367411861.png" alt="jthi_0-1735367411861.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Graph Builder(
	Size(438, 629),
	Show Control Panel(0),
	Fit to Window("Off"),
	Page Level Fill Color("White"),
	Graph Spacing(15),
	Spacing Borders(1),
	Variables(
		X(:UMAP1),
		X(:UMAP1 CENTER by CLUSTER, Position(1)),
		Y(:UMAP2),
		Y(:UMAP2 CENTER by CLUSTER, Position(1)),
		Color(:WARD UMAP CLUSTERS)
	),
	Elements(
		Points(X(1), Y(1), Legend(27)),
		Points(
			X(2),
			Y(1),
			Color(0),
			Legend(32),
			Summary Statistic("Mean"),
			Label("Label by Row")
		)
	),
	SendToReport(
		Dispatch({}, "400", ScaleBox,
			{Legend Model(
				32,
				Properties(0, {Line Color(16)}, Item ID("Mean(UMAP2)", 1))
			)}
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;CODE class=" language-jsl"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 28 Dec 2024 06:32:14 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/WINDOWS-10-gt-JMP-17-2-gt-Graph-Builder-gt-Scatter-Plot-gt/m-p/825364#M100543</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-12-28T06:32:14Z</dc:date>
    </item>
    <item>
      <title>Re: WINDOWS 10 &gt; JMP 17.2 &gt; Graph Builder &gt; Scatter Plot &gt; Dynamic Cluster Annotation</title>
      <link>https://community.jmp.com/t5/Discussions/WINDOWS-10-gt-JMP-17-2-gt-Graph-Builder-gt-Scatter-Plot-gt/m-p/825409#M100552</link>
      <description>&lt;P&gt;Hi Jarmo,&lt;/P&gt;
&lt;P&gt;Thank you for providing a much simpler solution to my initial challenge. Still, I would like to change the Labels' Font Size and Color to make the plot more readable. Do you have any clues on how I could achieve that task?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;TS&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 28 Dec 2024 18:20:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/WINDOWS-10-gt-JMP-17-2-gt-Graph-Builder-gt-Scatter-Plot-gt/m-p/825409#M100552</guid>
      <dc:creator>Thierry_S</dc:creator>
      <dc:date>2024-12-28T18:20:18Z</dc:date>
    </item>
    <item>
      <title>Re: WINDOWS 10 &gt; JMP 17.2 &gt; Graph Builder &gt; Scatter Plot &gt; Dynamic Cluster Annotation</title>
      <link>https://community.jmp.com/t5/Discussions/WINDOWS-10-gt-JMP-17-2-gt-Graph-Builder-gt-Scatter-Plot-gt/m-p/825424#M100557</link>
      <description>&lt;P&gt;I think then you will have to utilize graphic script as labels do not have that many customization options (to change the text size you would have to change font preferences).&lt;/P&gt;</description>
      <pubDate>Sun, 29 Dec 2024 07:31:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/WINDOWS-10-gt-JMP-17-2-gt-Graph-Builder-gt-Scatter-Plot-gt/m-p/825424#M100557</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-12-29T07:31:29Z</dc:date>
    </item>
    <item>
      <title>Re: WINDOWS 10 &gt; JMP 17.2 &gt; Graph Builder &gt; Scatter Plot &gt; Dynamic Cluster Annotation</title>
      <link>https://community.jmp.com/t5/Discussions/WINDOWS-10-gt-JMP-17-2-gt-Graph-Builder-gt-Scatter-Plot-gt/m-p/825436#M100567</link>
      <description>&lt;P&gt;Interesting, Labels of Bar graphs have a command to adjust the font, but point graph don't?&lt;BR /&gt;&lt;LI-MESSAGE title="Graph builder bar chart data label control" uid="343142" url="https://community.jmp.com/t5/JMP-Wish-List/Graph-builder-bar-chart-data-label-control/m-p/343142#U343142" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-idea-thread lia-fa-icon lia-fa-idea lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp; -&amp;gt; interesting as well for other plot types?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Graph Builder(
	Variables( X( :WARD UMAP CLUSTERS ) ),
	Elements( Bar( X, Legend( 5 ), Label( "Label by Value" ) ) )
);

labels = (current report()[FrameBox(1)] &amp;lt;&amp;lt; find segs)[1];


labels &amp;lt;&amp;lt; Set Font( "", 18, "", 0 )&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 29 Dec 2024 17:06:40 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/WINDOWS-10-gt-JMP-17-2-gt-Graph-Builder-gt-Scatter-Plot-gt/m-p/825436#M100567</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2024-12-29T17:06:40Z</dc:date>
    </item>
    <item>
      <title>Re: WINDOWS 10 &gt; JMP 17.2 &gt; Graph Builder &gt; Scatter Plot &gt; Dynamic Cluster Annotation</title>
      <link>https://community.jmp.com/t5/Discussions/WINDOWS-10-gt-JMP-17-2-gt-Graph-Builder-gt-Scatter-Plot-gt/m-p/825443#M100569</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Once again, I tried to make it more complicated than necessary.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the short JSL script I created, which does everything I needed.&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);

dt = Data Table ("ANNOTATION of 2D CLUSTERS");

Summarize (dt, clu_id = By (:WARD UMAP CLUSTERS), x_pos = Mean (:UMAP1 CENTER by CLUSTER), y_pos = Mean(:UMAP2 CENTER by CLUSTER));

clu_n = N items (clu_id);

colors = {};

vect = dt:WARD UMAP CLUSTERS &amp;lt;&amp;lt; Get Property ("Value Colors");
For (j = 1, j &amp;lt;= clu_n, j++,
	insert into(colors, num (word(-1, char(vect [j]), "=")))
);

gb = dt &amp;lt;&amp;lt; Graph Builder(
	Size( 483, 675 ),
	Fit to Window( "Off" ),
	Page Level Fill Color( "White" ),
	Graph Spacing( 15 ),
	Spacing Borders( 1 ),
	Variables( X( :UMAP1 ), Y( :UMAP2 ), Color( :WARD UMAP CLUSTERS ) ),
	Elements( Points( X, Y, Legend( 27 ) ) ),
	SendToReport(
		Dispatch(
			{},
			"Graph Builder",
			FrameBox,
			{Add Graphics Script(
				10,
				Description( "" ),
				Text Size (14);
				For( i = 1, i &amp;lt;= clu_n, i++,
					Label = clu_id [i];
					Fill Color ("white");
					Transparency (0.85);
					Circle ({x_pos [i], y_pos [i]+0.25}, 0.5, "FILL");
					Transparency (1);
					Text Color (colors [i]);
					Text( center justified, {x_pos [i], y_pos [i]}, Label );
				)
			)}
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Although I am unsure whether my crude method for collecting the Value Colors is efficient, it works.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;TS&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Dec 2024 06:05:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/WINDOWS-10-gt-JMP-17-2-gt-Graph-Builder-gt-Scatter-Plot-gt/m-p/825443#M100569</guid>
      <dc:creator>Thierry_S</dc:creator>
      <dc:date>2024-12-30T06:05:37Z</dc:date>
    </item>
    <item>
      <title>Re: WINDOWS 10 &gt; JMP 17.2 &gt; Graph Builder &gt; Scatter Plot &gt; Dynamic Cluster Annotation</title>
      <link>https://community.jmp.com/t5/Discussions/WINDOWS-10-gt-JMP-17-2-gt-Graph-Builder-gt-Scatter-Plot-gt/m-p/825516#M100584</link>
      <description>&lt;P&gt;I think your method is just fine. You can also use Arg() to get the items from the value colors list of "things". I would also evaluate the variables outside of the graphic script INSIDE the graphic script to avoid all sorts of annoying issues when the variables are lost.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would most likely use Associative Array to collect ids, colors, x and y coordinates. One issue with this could be that Summarize and Associative Array might have different ordering and it would have to be taken into account (I haven't done it here).&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);

dt = Data Table("ANNOTATION of 2D CLUSTERS");

Summarize(
	dt,
	clu_id = By(:WARD UMAP CLUSTERS),
	x_pos = Mean(:UMAP1 CENTER by CLUSTER),
	y_pos = Mean(:UMAP2 CENTER by CLUSTER)
);

vect = dt:WARD UMAP CLUSTERS &amp;lt;&amp;lt; Get Property("Value Colors");

aa_colors = Associative Array();

For Each({item, idx}, vect,
	aa_colors[Arg(item, 1)] = Associative Array();
	aa_colors[Arg(item, 1)]["Color"] = Arg(item, 2);
	aa_colors[Arg(item, 1)]["X"] = x_pos[idx];
	aa_colors[Arg(item, 1)]["Y"] = y_pos[idx];	
);

gb = dt &amp;lt;&amp;lt; Graph Builder(
	Size(483, 675),
	Fit to Window("Off"),
	Page Level Fill Color("White"),
	Graph Spacing(15),
	Spacing Borders(1),
	Variables(X(:UMAP1), Y(:UMAP2), Color(:WARD UMAP CLUSTERS)),
	Elements(Points(X, Y, Legend(27)))
);

Eval(EvalExpr(
	Report(gb)[FrameBox(1)] &amp;lt;&amp;lt; Add Graphics Script(
		Text Size (14);
		myaa = Expr(aa_colors);
		ids = myaa &amp;lt;&amp;lt; get keys;
		For(i = 1, i &amp;lt;= N Items(ids), i++,
			Fill Color ("white");
			Transparency (0.85);
			Circle({myaa[ids[i]]["X"], myaa[ids[i]]["Y"] + 0.25}, 0.5, "FILL");
			Transparency(1);
			Text Color(myaa[ids[i]]["Color"]);
			Text(center justified, {myaa[ids[i]]["X"], myaa[ids[i]]["Y"]}, Char(ids[i]));
		);
	)
));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Dec 2024 07:51:14 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/WINDOWS-10-gt-JMP-17-2-gt-Graph-Builder-gt-Scatter-Plot-gt/m-p/825516#M100584</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-12-31T07:51:14Z</dc:date>
    </item>
  </channel>
</rss>

