<?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: Line Profile in JMP? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Line-Profile-in-JMP/m-p/567678#M77852</link>
    <description>&lt;P&gt;OK, I will add a wish to implement it directly in JMP&amp;nbsp; :)&lt;/img&gt;&lt;BR /&gt;edit: here it is&amp;nbsp;&lt;LI-MESSAGE title="Line annotation: option to generate linecut plot" uid="567688" url="https://community.jmp.com/t5/JMP-Wish-List/Line-annotation-option-to-generate-linecut-plot/m-p/567688#U567688" 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;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;As a workaround:&lt;/STRONG&gt;&lt;BR /&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/92"&gt;@pauldeen&lt;/a&gt;&amp;nbsp;Your suggestion is already quite good, but it would be great to have the chance to &amp;gt;&lt;EM&gt;draw&amp;lt;&lt;/EM&gt; the line instead of defining it with a filter function.&lt;BR /&gt;&lt;BR /&gt;Your suggestion helped me to get away from the "line annotation" idea.&lt;/P&gt;
&lt;P&gt;How about using the lasso selection in the Heatmap Plot? (ifthe monitor allows "touch", one can draw a straight-ish line with the finger : )&lt;BR /&gt;Afterwards, the selection can be used to filter the data, average over the non-excluded values and generate the plot:&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="hogi_4-1668072748742.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/47224i017F842723CC1DFA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_4-1668072748742.png" alt="hogi_4-1668072748742.png" /&gt;&lt;/span&gt;&amp;nbsp;-&amp;gt;&amp;nbsp;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_1-1668071946884.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/47221i23D706EF20543FC3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_1-1668071946884.png" alt="hogi_1-1668071946884.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;result:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_6-1668073635929.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/47226i7E2B92505F20096B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_6-1668073635929.png" alt="hogi_6-1668073635929.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 10 Nov 2022 15:43:39 GMT</pubDate>
    <dc:creator>hogi</dc:creator>
    <dc:date>2022-11-10T15:43:39Z</dc:date>
    <item>
      <title>Line Profile in JMP?</title>
      <link>https://community.jmp.com/t5/Discussions/Line-Profile-in-JMP/m-p/567605#M77848</link>
      <description>&lt;P&gt;Is there a function available in JMP to generate a line profile from a Heatmap Plot, similar to "plot profile" in imageJ?&lt;BR /&gt;e.g. via hidden shift-rightClick menu of a line annotation?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_3-1668060349216.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/47218i5C2FDB1F5E134CAF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_3-1668060349216.png" alt="hogi_3-1668060349216.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 11 Jun 2023 11:29:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Line-Profile-in-JMP/m-p/567605#M77848</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2023-06-11T11:29:16Z</dc:date>
    </item>
    <item>
      <title>Re: Line Profile in JMP?</title>
      <link>https://community.jmp.com/t5/Discussions/Line-Profile-in-JMP/m-p/567654#M77851</link>
      <description>&lt;P&gt;So far the best i've been able to do is generate a sufficiently high density point cloud (grid in contour plot) and then use a graph builder with a local data filter to restrict the depth around the line you are interested in. It is not easy, so this would be good functionality to have built in!&lt;/P&gt;</description>
      <pubDate>Thu, 10 Nov 2022 08:38:48 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Line-Profile-in-JMP/m-p/567654#M77851</guid>
      <dc:creator>pauldeen</dc:creator>
      <dc:date>2022-11-10T08:38:48Z</dc:date>
    </item>
    <item>
      <title>Re: Line Profile in JMP?</title>
      <link>https://community.jmp.com/t5/Discussions/Line-Profile-in-JMP/m-p/567678#M77852</link>
      <description>&lt;P&gt;OK, I will add a wish to implement it directly in JMP&amp;nbsp; :)&lt;/img&gt;&lt;BR /&gt;edit: here it is&amp;nbsp;&lt;LI-MESSAGE title="Line annotation: option to generate linecut plot" uid="567688" url="https://community.jmp.com/t5/JMP-Wish-List/Line-annotation-option-to-generate-linecut-plot/m-p/567688#U567688" 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;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;As a workaround:&lt;/STRONG&gt;&lt;BR /&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/92"&gt;@pauldeen&lt;/a&gt;&amp;nbsp;Your suggestion is already quite good, but it would be great to have the chance to &amp;gt;&lt;EM&gt;draw&amp;lt;&lt;/EM&gt; the line instead of defining it with a filter function.&lt;BR /&gt;&lt;BR /&gt;Your suggestion helped me to get away from the "line annotation" idea.&lt;/P&gt;
&lt;P&gt;How about using the lasso selection in the Heatmap Plot? (ifthe monitor allows "touch", one can draw a straight-ish line with the finger : )&lt;BR /&gt;Afterwards, the selection can be used to filter the data, average over the non-excluded values and generate the plot:&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="hogi_4-1668072748742.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/47224i017F842723CC1DFA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_4-1668072748742.png" alt="hogi_4-1668072748742.png" /&gt;&lt;/span&gt;&amp;nbsp;-&amp;gt;&amp;nbsp;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_1-1668071946884.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/47221i23D706EF20543FC3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_1-1668071946884.png" alt="hogi_1-1668071946884.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;result:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_6-1668073635929.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/47226i7E2B92505F20096B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_6-1668073635929.png" alt="hogi_6-1668073635929.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Nov 2022 15:43:39 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Line-Profile-in-JMP/m-p/567678#M77852</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2022-11-10T15:43:39Z</dc:date>
    </item>
    <item>
      <title>Re: Line Profile in JMP?</title>
      <link>https://community.jmp.com/t5/Discussions/Line-Profile-in-JMP/m-p/567812#M77870</link>
      <description>&lt;P&gt;Combining both ideas ...&lt;BR /&gt;For Line Annotations, what is the JSL command to get the start and end point (in the coordinate system of the plot)?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-SPOILER&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Open( "$SAMPLE_STIPS/Wafer Stacked Small.jmp" );
gb = Graph Builder(
	Size( 534, 464 ),
	Show Control Panel( 0 ),
	Graph Spacing( 4 ),
	Variables( X( :X_Die ), Y( :Y_Die ), Color(:Defects) ),
	Elements( Heatmap( X, Y, Legend( 5 ) ) ),

);

myLine = gb &amp;lt;&amp;lt; Add Line Annotation( Line( {150, 120}, {450, 400} ), Color( "Light Yellow" ), Thick( 1 ), Point to( 1 ) );
myLine &amp;lt;&amp;lt; Get coordinates;

// gap in the code -------------------

x1 = 10;
x2 = -11;
y1 = -13;
y2 = 10;

dx = x2 - x1;
dy = y2 - y1;

xx = :x_Die &amp;lt;&amp;lt; get values();
yy = :y_Die &amp;lt;&amp;lt; get values();

px = (xx - x1);
py = (yy - y1);
dotp = (px * dx + py * dy);
denom = dx * dx + dy * dy;
proj = dotp :*&lt;/img&gt; dotp / denom;
lensq= px :*&lt;/img&gt; px + py :*&lt;/img&gt; py;
dist = Sqrt( lensq - proj );
selection = Loc( dist &amp;lt; 0.5 );
posAlongLine=sqrt(lensq[selection]);

dt &amp;lt;&amp;lt; Select rows(selection);
subS= dt &amp;lt;&amp;lt; Subset(Invisible, Selected Rows( 1 ), columns( :X_Die, :Y_Die, :Defects ), hidden );

subS &amp;lt;&amp;lt; 
	New Column("posAlongLine", Numeric, "Continuous");
subS:posAlongLine &amp;lt;&amp;lt; set values(posAlongLine);

subS &amp;lt;&amp;lt; Graph Builder(
	Transform Column( "value", Formula( Col Mean( :Defects,:X_Die,Y_Die ) ) ),
	Size( 530, 357 ),
	Show Control Panel( 0 ),
	Graph Spacing( 4 ),
	Variables( X( :posAlongLine ), Y( :value ) ),
	Elements(
		Points( X, Y, Legend( 3 ) ),
		Smoother( X, Y, Legend( 4 ), Lambda( 0.5 ) )
	)
)&lt;/CODE&gt;&lt;/PRE&gt;&lt;/LI-SPOILER&gt;</description>
      <pubDate>Thu, 10 Nov 2022 16:57:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Line-Profile-in-JMP/m-p/567812#M77870</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2022-11-10T16:57:15Z</dc:date>
    </item>
    <item>
      <title>Re: Line Profile in JMP?</title>
      <link>https://community.jmp.com/t5/Discussions/Line-Profile-in-JMP/m-p/567876#M77877</link>
      <description>&lt;P&gt;Using Mouse trap with some support variables to allow user to "drag" a line, the script is a mess but I think there could be something here after some cleaning and error handling.&lt;/P&gt;
&lt;LI-SPOILER&gt;
&lt;PRE&gt;Names Default To Here(1);
first = 1;
startx = 0;
starty = 0;
exx = 0;
exy = 0;
mouse_released = 0;

dt = Open("$SAMPLE_STIPS/Wafer Stacked Small.jmp");

xx = :x_Die &amp;lt;&amp;lt; get values();
yy = :y_Die &amp;lt;&amp;lt; get values();

New Window("",
	H List Box(
		gb = dt &amp;lt;&amp;lt; Graph Builder(
			Size(534, 464),
			Show Control Panel(0),
			Graph Spacing(4),
			Variables(X(:X_Die), Y(:Y_Die), Color(:Defects)),
			Elements(Heatmap(X, Y, Legend(5)))
		),
		V List Box(
			Spacer Box(size(600, 0)),
			H List Box(
				Spacer box(size(0, 500)),
				gb2_container = V List Box();
			)
		)
	)
);

sel_rows = Expr(
	x1 = startx;
	x2 = exx;
	y1 = starty;
	y2 = exy;
	
	dx = x2 - x1;
	dy = y2 - y1;
	
	px = (xx - x1);
	py = (yy - y1);
	
	dotp = (px * dx + py * dy);
	denom = dx * dx + dy * dy;
	proj = dotp :*&lt;/img&gt; dotp / denom;
	lensq = px :*&lt;/img&gt; px + py :*&lt;/img&gt; py;
	dist = Sqrt(lensq - proj);
	selection = Loc(dist &amp;lt; 0.5);
	If(N Items(selection) &amp;gt; 0,
		posAlongLine = Sqrt(lensq[selection]);

		If(!IsEmpty(dt_temp),
			Close(dt_temp, no save);
		);
		
		dt &amp;lt;&amp;lt; Clear Select;
		dt &amp;lt;&amp;lt; Select rows(selection);
		dt_temp = dt &amp;lt;&amp;lt; Subset(Invisible, Rows(selection), columns(:X_Die, :Y_Die, :Defects), hidden);
		dt_temp &amp;lt;&amp;lt; New Column("posAlongLine", Numeric, "Continuous", values(posAlongLine));

		gb2_container &amp;lt;&amp;lt; Append(
			gb2 = dt_temp &amp;lt;&amp;lt; Graph Builder(
				Transform Column("value", Formula(Col Mean(:Defects, :X_Die, Y_Die))),
				Size(530, 357),
				Show Control Panel(0),
				Graph Spacing(4),
				Variables(X(:posAlongLine), Y(:value)),
				Elements(Points(X, Y, Legend(3)), Smoother(X, Y, Legend(4), Lambda(0.5)))
			);
		);
	);
);

l = Report(gb)[FrameBox(1)] &amp;lt;&amp;lt; add graphics script(
	Mousetrap(
		If(first == 1,
			dt &amp;lt;&amp;lt; Clear Select;
			startx = x;
			starty = y;
			first++;
		);
		exx = x;
		exy = y;,
		first = 1;
		mouse_released = 1;
	);
	
	myline = Line({startx, starty}, {exx, exy});
	
	If(mouse_released,
		sel_rows;
	);
	mouse_released = 0;

);
&lt;/PRE&gt;
&lt;/LI-SPOILER&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_1-1668103786970.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/47233i2EA1E4E8871FC9C6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_1-1668103786970.png" alt="jthi_1-1668103786970.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Nov 2022 18:11:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Line-Profile-in-JMP/m-p/567876#M77877</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2022-11-10T18:11:23Z</dc:date>
    </item>
    <item>
      <title>Re: Line Profile in JMP?</title>
      <link>https://community.jmp.com/t5/Discussions/Line-Profile-in-JMP/m-p/567877#M77878</link>
      <description>&lt;P&gt;cool! :)&lt;/img&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Nov 2022 18:15:46 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Line-Profile-in-JMP/m-p/567877#M77878</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2022-11-10T18:15:46Z</dc:date>
    </item>
    <item>
      <title>Re: Line Profile in JMP?</title>
      <link>https://community.jmp.com/t5/Discussions/Line-Profile-in-JMP/m-p/567886#M77883</link>
      <description>&lt;P&gt;I wondered why there is no need for a&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;try(gb2&amp;lt;&amp;lt; delete;);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;in front of the "Append" function.&lt;/P&gt;&lt;P&gt;Because gb2 is newly defined every time and this triggers the automatic deletion of the old plot?&lt;/P&gt;&lt;P&gt;&lt;STRIKE&gt;(without "gb2 =" the plots are appended)&lt;/STRIKE&gt; actually: no&lt;BR /&gt;wow! why?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It just doesn't work if the code is executed twice. Then a second linecut is Appended.&lt;/P&gt;&lt;P&gt;why?&lt;/P&gt;</description>
      <pubDate>Thu, 10 Nov 2022 18:51:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Line-Profile-in-JMP/m-p/567886#M77883</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2022-11-10T18:51:03Z</dc:date>
    </item>
    <item>
      <title>Re: Line Profile in JMP?</title>
      <link>https://community.jmp.com/t5/Discussions/Line-Profile-in-JMP/m-p/567889#M77884</link>
      <description>&lt;P&gt;I lazily let gb2 to be deleted when dt_temp is closed.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Nov 2022 18:45:07 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Line-Profile-in-JMP/m-p/567889#M77884</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2022-11-10T18:45:07Z</dc:date>
    </item>
    <item>
      <title>Re: Line Profile in JMP?</title>
      <link>https://community.jmp.com/t5/Discussions/Line-Profile-in-JMP/m-p/567912#M77887</link>
      <description>&lt;P&gt;The Linecut adjusts now to the summary statistics (N, Mean, Median, Mode ...) of the Heatmap plot,&lt;/P&gt;&lt;P&gt;uses the X/Y group/wrap "column" as it's own overlay&lt;/P&gt;&lt;P&gt;and checks the global and local data filter&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;As input plot, you can use either the first/commented part - or your own Heatmap plot ...&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_0-1668281403484.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/47281i328F3FBD36068D8B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_0-1668281403484.png" alt="hogi_0-1668281403484.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-SPOILER&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;	
/*dt = Open( "$SAMPLE_STIPS/Wafer Stacked Small.jmp" );


dt &amp;lt;&amp;lt; Graph Builder(
	Size( 534, 464 ),
	Show Control Panel( 0 ),
	Graph Spacing( 4 ),
	Variables( X( :X_Die ), Y( :Y_Die ), Wrap( :Lot, Levels per Row( 3 ) ), Color( :Defects, Summary Statistic( "Sum" ) ) ),
	Elements( Heatmap( X, Y, Legend( 5 ) ) ),
	SendToReport(
		Dispatch( {}, "X_Die", ScaleBox, {Min( -22 ), Max( 22 ), Inc( 5 ), Minor Ticks( 4 )} ),
		Dispatch( {}, "Y_Die", ScaleBox, {Min( -20 ), Max( 22 ), Inc( 5 ), Minor Ticks( 4 )} ), 

	)

);*/


// second part --------------------------------------------------------

//Names Default To Here( 1 );

New Namespace(
	"LineScan"
);


LineScan:LS_Initialize = Function( {}, // variables used for communication between the Linescan and the Mousetrap
	LineScan:MyfirstClick = 1;
	LineScan:startx = 0;
	LineScan:starty = 0;
	LineScan:exx = 0;
	LineScan:exy = 0;
	LineScan:mouse_released = 0;
	LineScan:gb = 1;
	LineScan:dt = 1;
);

LineScan:CloseTemporaryTables() = Function( {},
	dtList = Get Data Table List();
	For Each( {checkDt, idx}, dtList,
		If( Not(IsMissing(Regex( checkDt &amp;lt;&amp;lt; get name(), "tempDTLineCutXY.*" ))) ,
			Print( checkDt &amp;lt;&amp;lt; get name() || ": close" );
			Close( checkDt, no save )
		)
	);
);

	
LineScan:LS_findVariables = Function( {},
	foundX = 0;
	foundY = 0;
	foundCol = 0;
	allVariables = (LineScan:gb &amp;lt;&amp;lt; get variables);
	For Each( {var, idx}, allVariables,
		If( Arg( var[2] ) == "X",
			xVar = var[1];
			foundX = 1;
		);
		If( Arg( var[2] ) == "Y",
			yVar = var[1];
			foundY = 1;
		);
		If( Arg( var[2] ) == "Color",
			colVar = var[1];
			foundCol = 1;
		
		);
	);
		
	LineScan:myStatistics = "Mean";
	LineScan:myGroups = {};
	gbScript = LineScan:gb &amp;lt;&amp;lt; Get Script;
	numArgs = N Arg( gbScript );
	For( i = 1, i &amp;lt;= numArgs, i++,
		If( Head Name( Arg( gbScript, i ) ) == "Variables", 
			//Print( "found variables", i );
			nVariables = N Arg( Arg( gbScript, i ) );
			For( k = 1, k &amp;lt;= nVariables, k++,
				If(
					Head Name( Arg( Arg( gbScript, i ), k ) ) == "Color", 
						//Print( "found color", k );
						nEntries = N Arg( Arg( gbScript, i ) );
						For( m = 1, m &amp;lt;= nEntries, m++,
							If( Head Name( Arg( Arg( Arg( gbScript, i ), k ), m ) ) == "Summary Statistic", 
								//Print( "found stat", m );
								LineScan:myStatistics = Arg( Arg( Arg( Arg( gbScript, i ), k ), m ), 1 )
							)
						);,
					myHead = Head Name( Arg( Arg( gbScript, i ), k ) );
					Contains( {"Group X", "Group Y", "Wrap"}, myHead );, 
						//Print( "found group ", k );
						Insert Into( LineScan:myGroups, Arg( Arg( Arg( gbScript, i ), k ), 1 ) )
				), 

			);
		)
	);
	foundX * foundY * foundCol;
);

		
LineScan:LS_sel_rows = Function( {}, 
		
	failed = 0;
	xx = xVar &amp;lt;&amp;lt; get values();
	yy = yVar &amp;lt;&amp;lt; get values();
	nr = N Items( yy );


	x1 = LineScan:startx;
	x2 = LineScan:exx;
	y1 = LineScan:starty;
	y2 = LineScan:exy;
	
	dx = x2 - x1;
	dy = y2 - y1;
	d1_2sq=( dx * dx + dy * dy );
	d1_2=  Sqrt(d1_2sq);// distance between points
			
			
		
	If( And( dx == 0, dy == 0 ),
		Print( "no line" );
		failed = 1;
	, 
	
		px1 = (xx - x1);
		py1 = (yy - y1);
	
		dotp1 = (px1 * dx + py1 * dy);
		proj1sq = dotp1 :*&lt;/img&gt; dotp1 / d1_2sq; // projection along the line
		proj1=sqrt(proj1sq);
		lensq = px1 :*&lt;/img&gt; px1 + py1 :*&lt;/img&gt; py1; // distance to pt1
		dist = Sqrt( lensq - proj1sq ); //Pythagoras
		
		selection = J( nr, 1 );
		width = If( Is Empty( widthEB ),
			Print( "use default" );
			0.7;
		,
			widthEB &amp;lt;&amp;lt; get()
		);
		selection[Loc( dist &amp;gt; width )] = .;
		
		px2 = (xx - x2);
		py2 = (yy - y2);
		dotp2 = (px2 * dx + py2 * dy);
		proj2sq = dotp2 :*&lt;/img&gt; dotp2 / d1_2sq;
		proj2=sqrt(proj2sq);

		
		selection[Loc( proj1 &amp;gt; d1_2 )] = .; //remove points too far away (radius aound start and end)
		selection[Loc( proj2 &amp;gt; d1_2 )] = .;
		
		filteredRows = Loc((1::nr)`);
		Try(
			ldf = Linescan:TheReport["Local Data Filter"] &amp;lt;&amp;lt; get scriptable object(); // wonderful (thank you Jim)
			filteredRows = ldf &amp;lt;&amp;lt; Get Filtered Rows;
		);
		
		
		excludedRows = J( nr, 1 );
		If(!IsMissing(filteredRows),	
		excludedRows[filteredRows] = .;
		excludedRows=Loc(excludedRows);
		selection[excludedRows] = .; //apply data filter
		);
		selection[LineScan:dt &amp;lt;&amp;lt; Get Excluded Rows()] = .; // apply global data filter
		
		
		selection = Loc( selection ); //just keep the non-empty ones
		If( N Items( selection ) &amp;lt;= 0,
			Print( "nothing selected" );
			failed = 1;
		,
			posAlongLine = proj1[selection];

			LineScan:CloseTemporaryTables();
				

			LineScan:dt &amp;lt;&amp;lt; Clear Select;
			LineScan:dt &amp;lt;&amp;lt; Select rows( selection );

					
			LineScan:dt_tempLineCut = LineScan:dt &amp;lt;&amp;lt; Subset( Invisible, Rows( selection ), Selected columns only( 0 ), hidden );
			LineScan:dt_tempLineCut &amp;lt;&amp;lt; New Column( "position along line", Numeric, "Continuous", values( posAlongLine ) );
			LineScan:dt_tempLineCut &amp;lt;&amp;lt; Set Name( "tempDTLineCutXY" );
		);
	);
	Not( failed );
);
			
LineScan:GetStatisticsFunction = Function( {myStat},
	Print( "implement" )
);

LineScan:LS_prepareExpressions = Function( {myStat}, 
	//Print( "LS: prepareExpressions" );
	myStatisticsFunction = Match( myStat,
		"N", Name Expr( Col Number ),
		"Mean", Name Expr( Col Mean ),
		"Mode", Name Expr( Col Mode ),
		"Sum", Name Expr( Col Sum ),
		"Std Dev", Name Expr( Col Std Dev ),
		"Min", Name Expr( Col Minimum ),
		"Max", Name Expr( Col Maximum ),
		"Median", Name Expr( Col Median ),
		"Range", Name Expr( Col Range ),
		"Cumulative Sum", Name Expr( Col Cumulative Sum ),
		Name Expr( Col Number )
	);
	LineScan:YvariableName = myStat || "(" || (colVar &amp;lt;&amp;lt; Get Name) || ")";
				
	LineScan:preparedYFunction = Substitute(
			Expr(
				__aggregation__( __colVar__, __xVar__, __yVar__ )
			),
		Expr( __aggregation__ ), Name Expr( myStatisticsFunction ),
		Expr( __colVar__ ), Name Expr( colVar ),
		Expr( __xVar__ ), Name Expr( xVar ),
		Expr( __yVar__ ), Name Expr( yVar ), 

	);
	If( myStat == "Median",
		LineScan:preparedYFunction = Insert( Name Expr( LineScan:preparedYFunction ), 0.5, 2 )
	);
	For Each( {GroupVar, idx}, LineScan:myGroups,
		LineScan:preparedYFunction = Insert( Name Expr( LineScan:preparedYFunction ), Name Expr( GroupVar ) )
	);
					
	LineScan:preparedVariables = Expr(
		Variables( X( :position along line ), Y( :YVariable ) )
	);
	If( N Items( LineScan:myGroups ),
		LineScan:preparedVariables = Insert( Name Expr( LineScan:preparedVariables ), Eval Expr( Overlay( Expr( LineScan:myGroups[1] ) ) ) )
	);
	1 //return value, don't delete !!!
	;
);

LineScan:LS_prepareWindow = Function( {}, 
	//Print( "LS: prepareWindow" );
	If( Is Empty( LineScan:LinecutWindow ),
		LineScan:LinecutWindow = New Window( "Linecut",
			Show Menu( 0 ),
			Show Toolbars( 0 ),
			V List Box(
				H List Box( Text Box( "width of the linecut: " ), widthEB = Number Edit Box( 0.6 ), Text Box( "   update? -&amp;gt;  draw a new line" ) ),
				Spacer Box( size( 100, 0 ) ),
				H List Box( Spacer Box( size( 0, 100 ) ), gb2_container = V List Box() )
			), 

		);
		LineScan:LinecutWindow &amp;lt;&amp;lt; on Close( // doesn't work ?!??!
			Print( "closing window" );
			LineScan:CloseTemporaryTables();

		)
				
		;
	,
		LineScan:LineCutWindow &amp;lt;&amp;lt; Bring Window To Front
	)
);

LineScan:LS_generateNewPlot = Function( {}, 
	//Print( "generatePlot" );
	Try( gbLC &amp;lt;&amp;lt; delete() );
					
	gb2_container &amp;lt;&amp;lt; Append(
		Eval(
			Substitute(
					Expr(
						gbLC = LineScan:dt_tempLineCut &amp;lt;&amp;lt; Graph Builder(
							Transform Column( "YVariable", Formula( __statistics__ ) ),
							Size( 450, 250 ),
							Show Control Panel( 0 ),
							Show Legend( 0 ),
							Show Title( 0 ),
							Fit Window(),
							Graph Spacing( 4 ),
							__variables__,
							Elements( Points( X, Y, Legend( 3 ) ), Smoother( X, Y, Legend( 4 ), Lambda( 0.005 ) ) )
						)
					),
				Expr( __statistics__ ), Name Expr( LineScan:preparedYFunction ),
				Expr( __variables__ ), Name Expr( LineScan:preparedVariables )
			)
		)
	);
	If( N Items( LineScan:myGroups ),
		gbLC &amp;lt;&amp;lt; Show Legend( 1 )
	);
	Report( gbLC )[AxisBox( 1 )] &amp;lt;&amp;lt; Min( 0 );
	Report( gbLC )[Text Edit Box( 4 )] &amp;lt;&amp;lt; Set Text( LineScan:YvariableName );
	Report( gbLC )[Outline Box( 1 )] &amp;lt;&amp;lt; Set Title( "Linecut" );
	
);
	
LineScan:LS_update = Function( {},
	{Default Local}, 
	//Print( "LS: update" );
	If( LineScan:LS_findVariables(), 

		If( LineScan:LS_sel_rows(), 
				
			LineScan:LS_prepareExpressions( Linescan:myStatistics );
			LineScan:LS_prepareWindow();
			LineScan:LS_generateNewPlot();
		)
	)
);
	
LineScan:LS_getMousetrapCoordinates = Function( {},
	If( LineScan:MyfirstClick == 1, 
					
		LineScan:dt &amp;lt;&amp;lt; Clear Select;
		LineScan:startx = x;
		LineScan:starty = y;
		LineScan:MyfirstClick++;
	);
	LineScan:exx = x;
	LineScan:exy = y;
);	


// now let's add the MouseTrap

LineScan:LS_Initialize();


Try(
	LineScan:CloseTemporaryTables();
	Linescan:TheReport = Current Report();
	gbrs = (Current Report() &amp;lt;&amp;lt; XPath( "//OutlineBox[@helpKey = 'Graph Builder']" ));
	If( N Items( gbrs ),
		Linescan:gb = gbrs[1] &amp;lt;&amp;lt; Get Scriptable Object();
		Linescan:dt = Linescan:gb &amp;lt;&amp;lt; Get Data Table();	
		
		FrameBoxes = gbrs[1] &amp;lt;&amp;lt; XPath( "//FrameBox" );
		For Each( {myFrameBox, idx}, FrameBoxes, 

			myFrameBox &amp;lt;&amp;lt; add graphics script(
				Mousetrap(
					LineScan:LS_getMousetrapCoordinates(),
					LineScan:MyfirstClick = 1;
					LineScan:mouse_released = 1;
				);
	
				myline = Line( {LineScan:startx, LineScan:starty}, {LineScan:exx, LineScan:exy} );
	
				If( LineScan:mouse_released,
					If( 0,
						Print( 1 ),
						LineScan:LS_update()
					)
				);
				LineScan:mouse_released = 0;
			)
		);
	);
);



&lt;/CODE&gt;&lt;/PRE&gt;&lt;/LI-SPOILER&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 12 Nov 2022 19:30:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Line-Profile-in-JMP/m-p/567912#M77887</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2022-11-12T19:30:35Z</dc:date>
    </item>
    <item>
      <title>Re: Line Profile in JMP?</title>
      <link>https://community.jmp.com/t5/Discussions/Line-Profile-in-JMP/m-p/570914#M78087</link>
      <description>&lt;P&gt;I just noticed that the selected data values (pink) for the linecut are slightly shifted with respect to the selection line (black).&lt;/P&gt;&lt;P&gt;At first sight, I thought that there is an error in the selection formula.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But it's the way the Heatmap plot is generated.&lt;/P&gt;&lt;P&gt;Let's say the x, y axes are defined with minor tick spacing dx / dy&lt;/P&gt;&lt;P&gt;Then the the Heatmap grid has the ame steps: dx, dy.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The&amp;nbsp;color the tile at the position X -- X+dx /&amp;nbsp; Y -- Y +dy is determined by aggregating&amp;nbsp;all data points with X &amp;lt;= x &amp;lt;&amp;nbsp; X+ dx, Y &amp;lt;= y&amp;lt;= Y + dy.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If there are many data points in this area, the approach is perfect.&lt;/P&gt;&lt;P&gt;But for unit steps (1 data point per tile; e.g. integer steps, 1, 2, 3, ...) one clearly see the offset. It comes from the asymmetry:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;= on the left.&lt;/P&gt;&lt;P&gt;&amp;lt; on the right.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;neither of the symmetric versions&lt;/P&gt;&lt;P&gt;&amp;lt;=&amp;nbsp; &amp;nbsp;... &amp;lt;=&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt; ... &amp;lt;&lt;/P&gt;&lt;P&gt;would be acceptable :)&lt;/img&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there an option in JMP to shift the aggregation to&amp;nbsp;&lt;/P&gt;&lt;P&gt;X -dx/2 &amp;lt;= x&amp;nbsp; &amp;lt; X+dx/2,&lt;BR /&gt;Y -dy/2 &amp;lt;= y&amp;nbsp; &amp;lt; Y+dy/2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From mathematical point of view, there won't be a benefit.&lt;/P&gt;&lt;P&gt;But for 99% of the use cases: (esp: integer , unit steps grids 1,2,3,4 ...)&amp;nbsp; definitely yes !&amp;nbsp;&amp;nbsp;:)&lt;/img&gt;&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="hogi_1-1668764369924.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/47452i07EAD275AF66D252/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_1-1668764369924.png" alt="hogi_1-1668764369924.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Nov 2022 09:39:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Line-Profile-in-JMP/m-p/570914#M78087</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2022-11-18T09:39:37Z</dc:date>
    </item>
    <item>
      <title>Re: Line Profile in JMP?</title>
      <link>https://community.jmp.com/t5/Discussions/Line-Profile-in-JMP/m-p/578797#M78613</link>
      <description>&lt;P&gt;I added the &lt;STRONG&gt;Lincut&lt;/STRONG&gt; function from this conversation to the &lt;STRONG&gt;GraphBuilderToolbar&lt;/STRONG&gt;:&lt;BR /&gt;&lt;LI-MESSAGE title="Graph Builder Toolbar" uid="565466" url="https://community.jmp.com/t5/JMP-Add-Ins/Graph-Builder-Toolbar/m-p/565466#U565466" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-tkb-thread lia-fa-icon lia-fa-tkb lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;&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="hogi_0-1670488608856.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/48030iC426A14F71D16A8D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_0-1670488608856.png" alt="hogi_0-1670488608856.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jun 2023 20:53:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Line-Profile-in-JMP/m-p/578797#M78613</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2023-06-27T20:53:15Z</dc:date>
    </item>
  </channel>
</rss>

