<?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 loop through the unique values of a column to fit a line in a bivariate plot? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-loop-through-the-unique-values-of-a-column-to-fit-a-line/m-p/621219#M82035</link>
    <description>&lt;P&gt;I think what you're looking for is the groupby() arg.&amp;nbsp; If you want to specify colors, definitely it's easier to do at the column level like&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;&amp;nbsp;said.&amp;nbsp;&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 = open("$SAMPLE_DATA\Big Class.jmp");
biv = dt &amp;lt;&amp;lt; Bivariate(
	Y( :weight ),
	X( :height ),
	Group BY(:sex), 
	Fit line()
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 08 Apr 2023 00:06:32 GMT</pubDate>
    <dc:creator>vince_faller</dc:creator>
    <dc:date>2023-04-08T00:06:32Z</dc:date>
    <item>
      <title>How to loop through the unique values of a column to fit a line in a bivariate plot?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-loop-through-the-unique-values-of-a-column-to-fit-a-line/m-p/621200#M82033</link>
      <description>&lt;P&gt;I am trying to write a jsl to plot a bivariate plot between x vs. y, group by the values in column 'b' and fit a line through each of the groups (from the unique values in column 'b'). The script generated from the manual bivariate plot I did is as follows but I cannot figure out how to do add a for loop for all the "Fit Where" commands that go through the unique values in column 'b'&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Bivariate(
	Y( :Name( "y" ) ),
	X( :Name( "x" ) ),
	Automatic Recalc( 1 ),
	Fit Where( :p&lt;/img&gt; == "grpA", Fit Line( {Line Color( {228, 26, 28} )} ) ),
	Fit Where(
		:b == "grpB",
		Fit Line( {Line Color( {55, 126, 184} )} )
	),
	Fit Where(
		:b == "grpC",
		Fit Line( {Line Color( {77, 175, 74} )} )
	),
	Fit Where(
		:b == "grpD",
		Fit Line( {Line Color( {152, 78, 163} )} )
	),
	Fit Where(
		:b == "grpE",
		Fit Line( {Line Color( {255, 127, 0} )} )
	),
	Fit Where(
		:b == "grpF",
		Fit Line( {Line Color( {166, 86, 40} )} )
	),
	Where( :c == "TT" &amp;amp; :e == "EE" ),
	SendToReport(
		Dispatch( {}, "1", ScaleBox, {Reversed Scale} ),
		Dispatch( {}, "2", ScaleBox, {Reversed Scale} ),
		Dispatch(
			{},
			"Bivar Plot",
			FrameBox,
			{Marker Size( 6 ), Row Legend(
				e,
				Color( 0 ),
				Color Theme( "" ),
				Marker( 1 ),
				Marker Theme( "Standard" ),
				Continuous Scale( 0 ),
				Reverse Scale( 0 ),
				Excluded Rows( 0 )
			)}
		),
		Dispatch( {}, "Linear Fit b==grpA, OutlineBox, {Close( 1 )} ),
		Dispatch( {}, "Linear Fit b==grpB", OutlineBox, {Close( 1 )} ),
		Dispatch(
			{},
			"Linear Fit b==grpC",
			OutlineBox,
			{Close( 1 )}
		),
		Dispatch(
			{},
			"Linear Fit b==grpD",
			OutlineBox,
			{Close( 1 )}
		),
		Dispatch(
			{},
			"Linear Fit b==grpE",
			OutlineBox,
			{Close( 1 )}
		),
		Dispatch(
			{},
			"Linear Fit b==grpF",
			OutlineBox,
			{Close( 1 )}
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 11 Jun 2023 11:31:21 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-loop-through-the-unique-values-of-a-column-to-fit-a-line/m-p/621200#M82033</guid>
      <dc:creator>FrequencyBison9</dc:creator>
      <dc:date>2023-06-11T11:31:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to loop through the unique values of a column to fit a line in a bivariate plot?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-loop-through-the-unique-values-of-a-column-to-fit-a-line/m-p/621216#M82034</link>
      <description>&lt;P&gt;I believe it will be easier to set the colors in a Column Property for variable :b, and to use a By() element.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);

:b &amp;lt;&amp;lt; set property("value colors",
	{"grp8" = {55, 126, 184} }, "grpC" = {77, 175, 74}  etc. }
);
Bivariate(
	Y( :x ),
	X( :y ),
	Fit Line( ),&lt;BR /&gt;    by( : B )
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 08 Apr 2023 01:24:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-loop-through-the-unique-values-of-a-column-to-fit-a-line/m-p/621216#M82034</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2023-04-08T01:24:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to loop through the unique values of a column to fit a line in a bivariate plot?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-loop-through-the-unique-values-of-a-column-to-fit-a-line/m-p/621219#M82035</link>
      <description>&lt;P&gt;I think what you're looking for is the groupby() arg.&amp;nbsp; If you want to specify colors, definitely it's easier to do at the column level like&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;&amp;nbsp;said.&amp;nbsp;&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 = open("$SAMPLE_DATA\Big Class.jmp");
biv = dt &amp;lt;&amp;lt; Bivariate(
	Y( :weight ),
	X( :height ),
	Group BY(:sex), 
	Fit line()
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 08 Apr 2023 00:06:32 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-loop-through-the-unique-values-of-a-column-to-fit-a-line/m-p/621219#M82035</guid>
      <dc:creator>vince_faller</dc:creator>
      <dc:date>2023-04-08T00:06:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to loop through the unique values of a column to fit a line in a bivariate plot?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-loop-through-the-unique-values-of-a-column-to-fit-a-line/m-p/621542#M82057</link>
      <description>&lt;P&gt;The Bivariate platform has its own Group By feature available from the platform menu or JSL:&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 = Open( "$SAMPLE_DATA/Big Class.jmp" );

obj = dt &amp;lt;&amp;lt; Bivariate(
	Y( :weight ),
	X( :height )
);

obj
	&amp;lt;&amp;lt; Group By( :sex )
	&amp;lt;&amp;lt; Fit Line;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 10 Apr 2023 18:32:09 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-loop-through-the-unique-values-of-a-column-to-fit-a-line/m-p/621542#M82057</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2023-04-10T18:32:09Z</dc:date>
    </item>
  </channel>
</rss>

