Is there a function available in JMP to generate a line profile from a Heatmap Plot, similar to "plot profile" in imageJ?e.g. via hidden shift-rightClick menu of a line annotation?
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.
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 << get values(); yy = :y_Die << get values(); New Window("", H List Box( gb = dt << 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 dotp / denom; lensq = px px + py py; dist = Sqrt(lensq - proj); selection = Loc(dist < 0.5); If(N Items(selection) > 0, posAlongLine = Sqrt(lensq[selection]); If(!IsEmpty(dt_temp), Close(dt_temp, no save); ); dt << Clear Select; dt << Select rows(selection); dt_temp = dt << Subset(Invisible, Rows(selection), columns(:X_Die, :Y_Die, :Defects), hidden); dt_temp << New Column("posAlongLine", Numeric, "Continuous", values(posAlongLine)); gb2_container << Append( gb2 = dt_temp << 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)] << add graphics script( Mousetrap( If(first == 1, dt << 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; );
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!
OK, I will add a wish to implement it directly in JMP edit: here it is Line annotation: option to generate linecut plot
As a workaround:@pauldeen Your suggestion is already quite good, but it would be great to have the chance to >draw< the line instead of defining it with a filter function.Your suggestion helped me to get away from the "line annotation" idea.
How about using the lasso selection in the Heatmap Plot? (ifthe monitor allows "touch", one can draw a straight-ish line with the finger : )Afterwards, the selection can be used to filter the data, average over the non-excluded values and generate the plot:
->
result:
Combining both ideas ...For Line Annotations, what is the JSL command to get the start and end point (in the coordinate system of the plot)?
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 << Add Line Annotation( Line( {150, 120}, {450, 400} ), Color( "Light Yellow" ), Thick( 1 ), Point to( 1 ) ); myLine << Get coordinates; // gap in the code ------------------- x1 = 10; x2 = -11; y1 = -13; y2 = 10; dx = x2 - x1; dy = y2 - y1; xx = :x_Die << get values(); yy = :y_Die << get values(); px = (xx - x1); py = (yy - y1); dotp = (px * dx + py * dy); denom = dx * dx + dy * dy; proj = dotp :*</img> dotp / denom; lensq= px :*</img> px + py :*</img> py; dist = Sqrt( lensq - proj ); selection = Loc( dist < 0.5 ); posAlongLine=sqrt(lensq[selection]); dt << Select rows(selection); subS= dt << Subset(Invisible, Selected Rows( 1 ), columns( :X_Die, :Y_Die, :Defects ), hidden ); subS << New Column("posAlongLine", Numeric, "Continuous"); subS:posAlongLine << set values(posAlongLine); subS << 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 ) ) ) )