<?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 fit y by x question: show equation on chart in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/fit-y-by-x-question-show-equation-on-chart/m-p/577180#M78476</link>
    <description>&lt;P&gt;Hi all JMP experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The equation along with R^2 are shown below in summary and it takes twice copy/paste to copy both the chart &amp;amp; summary to my slide.&lt;/P&gt;&lt;P&gt;So Is it possible to show the fitting equation &amp;amp; R-square on chart? The feature is feasible in Excel.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
    <pubDate>Sun, 11 Jun 2023 11:29:51 GMT</pubDate>
    <dc:creator>stevend1219</dc:creator>
    <dc:date>2023-06-11T11:29:51Z</dc:date>
    <item>
      <title>fit y by x question: show equation on chart</title>
      <link>https://community.jmp.com/t5/Discussions/fit-y-by-x-question-show-equation-on-chart/m-p/577180#M78476</link>
      <description>&lt;P&gt;Hi all JMP experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The equation along with R^2 are shown below in summary and it takes twice copy/paste to copy both the chart &amp;amp; summary to my slide.&lt;/P&gt;&lt;P&gt;So Is it possible to show the fitting equation &amp;amp; R-square on chart? The feature is feasible in Excel.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Sun, 11 Jun 2023 11:29:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/fit-y-by-x-question-show-equation-on-chart/m-p/577180#M78476</guid>
      <dc:creator>stevend1219</dc:creator>
      <dc:date>2023-06-11T11:29:51Z</dc:date>
    </item>
    <item>
      <title>Re: fit y by x question: show equation on chart</title>
      <link>https://community.jmp.com/t5/Discussions/fit-y-by-x-question-show-equation-on-chart/m-p/577203#M78477</link>
      <description>&lt;P&gt;There are a couple of ways to handle this.&amp;nbsp; With Fit Y by X, a little script can be added that can add the desired stats onto the graph.&amp;nbsp; Secondly, the Graph Builder has the feature you are looking for as a build in capability.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Dec 2022 06:49:36 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/fit-y-by-x-question-show-equation-on-chart/m-p/577203#M78477</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2022-12-05T06:49:36Z</dc:date>
    </item>
    <item>
      <title>Re: fit y by x question: show equation on chart</title>
      <link>https://community.jmp.com/t5/Discussions/fit-y-by-x-question-show-equation-on-chart/m-p/577794#M78527</link>
      <description>&lt;P&gt;Hi Jim, Thanks for the feedback! Could you give me a hint how the script looks like? Usually I start scripting by the template of functionality in GUI -&amp;gt; save to script, but not for this one because I couldn't find it in GUI. Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 06 Dec 2022 02:13:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/fit-y-by-x-question-show-equation-on-chart/m-p/577794#M78527</guid>
      <dc:creator>stevend1219</dc:creator>
      <dc:date>2022-12-06T02:13:15Z</dc:date>
    </item>
    <item>
      <title>Re: fit y by x question: show equation on chart</title>
      <link>https://community.jmp.com/t5/Discussions/fit-y-by-x-question-show-equation-on-chart/m-p/577799#M78528</link>
      <description>&lt;P&gt;Here is a simple example.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_1-1670294081868.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/47951iD62DB268A53578C1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="txnelson_1-1670294081868.png" alt="txnelson_1-1670294081868.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I developed it interactively by using the&amp;nbsp; Customize Graph designer dialog box available by right clicking on the graph and selecting "Customize".&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_0-1670293863962.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/47950iE7ACEA58B0DF38E9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="txnelson_0-1670293863962.png" alt="txnelson_0-1670293863962.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Once I developed the code, using the Text Template, I then had JMP generate the complete JSL, see below.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/big class.jmp" );

Bivariate(
	Y( :height ),
	X( :weight ),
	Fit Line( {Line Color( {212, 73, 88} )} ),
	SendToReport(
		Dispatch(
			{},
			"Bivar Plot",
			FrameBox,
			{Add Graphics Script(
				4,
				Description( "" ),
				Text(
					Center Justified,
					{75, 67},
					"R2 = " || Char( Round( (Current Report()[Number Col Box( 1 )] &amp;lt;&amp;lt; get)[1], 5 ) )
				)
			)}
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 06 Dec 2022 02:34:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/fit-y-by-x-question-show-equation-on-chart/m-p/577799#M78528</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2022-12-06T02:34:56Z</dc:date>
    </item>
    <item>
      <title>Re: fit y by x question: show equation on chart</title>
      <link>https://community.jmp.com/t5/Discussions/fit-y-by-x-question-show-equation-on-chart/m-p/578155#M78566</link>
      <description>&lt;P&gt;Here's an example with Graph Builder:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="pmroz_0-1670353546011.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/47974i20D66929DC06BD26/image-size/medium?v=v2&amp;amp;px=400" role="button" title="pmroz_0-1670353546011.png" alt="pmroz_0-1670353546011.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Note that I left the control panel open so you could see the options to display the line of fit.&lt;/P&gt;
&lt;P&gt;Here's the code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Graph Builder(
	Size( 909, 580 ),
	Variables( X( :weight ), Y( :height ) ),
	Elements(
		Points( X, Y, Legend( 5 ) ),
		Line Of Fit(
			X,
			Y,
			Legend( 7 ),
			Confidence of Prediction( 1 ),
			Root Mean Square Error( 1 ),
			R²( 1 ),
			Equation( 1 ),
			F Test( 1 )
		)
	)
);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 06 Dec 2022 19:06:49 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/fit-y-by-x-question-show-equation-on-chart/m-p/578155#M78566</guid>
      <dc:creator>pmroz</dc:creator>
      <dc:date>2022-12-06T19:06:49Z</dc:date>
    </item>
    <item>
      <title>Re: fit y by x question: show equation on chart</title>
      <link>https://community.jmp.com/t5/Discussions/fit-y-by-x-question-show-equation-on-chart/m-p/581449#M78832</link>
      <description>&lt;P&gt;Hi Jim, Thanks, it works, but encounter another problem: I'd like to use variables in the "{75, 67}," i.e. the position but seems the variables cannot be passed into the function. I need to use variable instead of fixed value because the text position should depend on x/y scale, which differs chart by chart.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Something like this: the &lt;EM&gt;my_pos_lst&lt;/EM&gt; seems cannot be successfully fed into the function. Do you have any idea? Thanks!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;my_pos_lst = {100, 100};

Bivariate(
	///...
			{Add Graphics Script(
				4,
				Description( "" ),
				Text(
					Center Justified,
					my_pos_lst,
					"R2 = " || Char( Round( (Current Report()[Number Col Box( 1 )] &amp;lt;&amp;lt; get)[1], 5 ) )
				)
			)}
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Dec 2022 14:47:07 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/fit-y-by-x-question-show-equation-on-chart/m-p/581449#M78832</guid>
      <dc:creator>stevend1219</dc:creator>
      <dc:date>2022-12-14T14:47:07Z</dc:date>
    </item>
    <item>
      <title>Re: fit y by x question: show equation on chart</title>
      <link>https://community.jmp.com/t5/Discussions/fit-y-by-x-question-show-equation-on-chart/m-p/581450#M78833</link>
      <description>&lt;P&gt;oh BTW, I've used evallist(my_pos_lst) whether outside or inside Bivariate function, but it still doesn't work.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Dec 2022 14:49:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/fit-y-by-x-question-show-equation-on-chart/m-p/581450#M78833</guid>
      <dc:creator>stevend1219</dc:creator>
      <dc:date>2022-12-14T14:49:23Z</dc:date>
    </item>
    <item>
      <title>Re: fit y by x question: show equation on chart</title>
      <link>https://community.jmp.com/t5/Discussions/fit-y-by-x-question-show-equation-on-chart/m-p/581547#M78843</link>
      <description>&lt;P&gt;It works for me&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_0-1671036794573.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/48305i3BC5031F07411E86/image-size/medium?v=v2&amp;amp;px=400" role="button" title="txnelson_0-1671036794573.png" alt="txnelson_0-1671036794573.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;It just isn't in the default range for the chart, so I had to scroll up to 100 on the Y axis to see it&lt;/P&gt;</description>
      <pubDate>Wed, 14 Dec 2022 16:54:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/fit-y-by-x-question-show-equation-on-chart/m-p/581547#M78843</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2022-12-14T16:54:45Z</dc:date>
    </item>
  </channel>
</rss>

