<?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: JSL &amp;gt; Graphic script &amp;amp;gt; Polygon &amp;gt; Dynamically assign coordinates in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/JSL-gt-Graphic-script-amp-gt-Polygon-gt-Dynamically-assign/m-p/342872#M59201</link>
    <description>After digging a bit more, I realized that I needed to use the List format for the polygon (i.e. Polygon ({x1,y1}, {x1,y2}, {x2,y2}, {x2,y1}) coordinates and not the Matrix format&lt;BR /&gt;&lt;BR /&gt;Best,&lt;BR /&gt;TS</description>
    <pubDate>Thu, 17 Dec 2020 21:47:14 GMT</pubDate>
    <dc:creator>Thierry_S</dc:creator>
    <dc:date>2020-12-17T21:47:14Z</dc:date>
    <item>
      <title>JSL &gt; Graphic script &amp;gt; Polygon &gt; Dynamically assign coordinates</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-gt-Graphic-script-amp-gt-Polygon-gt-Dynamically-assign/m-p/342822#M59192</link>
      <description>&lt;P&gt;Hi JMP community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In a simple script I'm currently developing,&amp;nbsp; I would like to draw a rectangle polygon in Graphic Script applied to a GraphBuilder FrameBox with dynamic coordinates in function of the the axis scale (i.e. Polygon ([X1, X1, X2, X2], [Y1, Y2, Y2, Y1]). While I can easily achieve this with "hard coded" numerical coordinates for the polygon, and I can easily dynamically calculate the values of X1, X2, Y1, and Y2; I have not been able to determine the proper syntax in my script to update dynamically these coordinates: the script below does not work because of the incorrect handling of the coordinate vector.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here (1);

dt1 = Data Table ("TABLE1.JMP");
dt2 = Data Table ("TABLE2.JMP");

CList = dt1 &amp;lt;&amp;lt; get column Names (string);


gbe = Expr (dt1 &amp;lt;&amp;lt; Graph Builder(
					Size( 838, 494 ),
					Variables(
						X( :COLUMNX ),
						Y( _YS_ ),
						Group X( :COLUMNSPLIT )
					),
					Elements(
						Points( X, Y, Legend( 4 ) ),
						Line Of Fit( X, Y, Legend( 6 ) ),
						Ellipse( X, Y, Legend( 7 ) )
					),
					SendToReport(
						Dispatch(
							{},
							"Graph Builder",
							FrameBox,
							{Left( 1 ), Right( 1 ), Top( 1 ), Bottom( 1 ),
							Add Graphics Script(
								2,
								Description( "Script" ),
								Fill Color( "white" );
								Transparency( 0.6 );
								Polygon( [-1, -1, 4.5, 4.5], _YVECTOR_ );
								Transparency( 1 );
								Text Size( 14 );
								Text color ("black");
								Text( right Justified, {4, _TPY1_}, _R1_ );
								Text Color (_TXTC1_);
								Text( right Justified, {4, _TPY2_}, _P1_ );
							), Grid Line Order( 1 ), Reference Line Order( 3 )}
						),
						Dispatch(
							{},
							"Graph Builder",
							FrameBox( 2 ),
							{Left( 1 ), Right( 1 ), Top( 1 ), Bottom( 1 ),
							Add Graphics Script(
								2,
								Description( "Script" ),
								Fill Color( "white" );
								Transparency( 0.6 );
								Polygon( [-1, -1, 4.5, 4.5], _YVECTOR_ );
								Transparency( 1 );
								Text Size( 14 );
								Text color ("black");
								Text( right Justified, {4, _TPY1_}, _R2_ );
								Text Color (_TXTC2_);
								Text( right Justified, {4, _TPY2_}, _P2_ );
							), Grid Line Order( 1 ), Reference Line Order( 3 )}
						)
					)
				)
			);	


For (i = 10, i &amp;lt;= 13, i++,            //101
		
		YCOL = Column (dt1, i);
		
		if (Column (dt2, 6) [i-9]&amp;lt;= 0.05, TEXTCOL1 = "red", TEXTCOL1 = "black");
		if (Column (dt2, 7) [i-9]&amp;lt;= 0.05, TEXTCOL2 = "red", TEXTCOL2 = "black");
			
		PVAL1 = "BH p: "||  CHAR(format(Column (dt2, 6) [i-9],"PValue"));
		PVAL2 = "BH p: "||  CHAR(format(Column (dt2, 7) [i-9],"PValue"));
		R1 = "r: "||  CHAR(format(Column (dt2, 4) [i-9],"Fixed Dec",6,3));
		R2 = "r: "||  CHAR(format(Column (dt2, 5) [i-9],"Fixed Dec",6,3));
		
		gbx = substitute(Name Expr (gbe), 	Expr (_YS_), YCOL,
											Expr (_TPY1_), 1,
											Expr (_TPY2_), 0.6,
											Expr (__YVECTOR_),[1,0.5,0.5,1],
											Expr (_TXTC1_), TEXTCOL1,
											Expr (_TXTC2_), TEXTCOL2,
											Expr (_P1_), PVAL1,
											Expr (_P2_), PVAL2,
											Expr (_R1_), R1,
											Expr (_R2_), R2
			);
			
		gb = Eval (gbx);
		
		gbr = gb &amp;lt;&amp;lt; report;
		
		Yaxis = gbr [Axis Box (2)];
		YMax = YAxis &amp;lt;&amp;lt; Get Max;
		YMin = YAxis &amp;lt;&amp;lt; Get Min;
		
		gbr &amp;lt;&amp;lt; close window;
		
		YRange = ABS (YMax - YMin);
		
		While (YRange &amp;lt;= 2,
			
			YMax = YMax + (YRange * 0.2);
			YMin = YMin - (YRange * 0.2);
			YRange = abs (YMax - YMin);
		);
		
		TOPY1 = YMax - (YRange * 0.05);
		TOPY2 = YMax - (YRange * 0.10);
		
		POLY1 = YMax;
		POLY2 = YMax - (YRange * 0.15);
		
		POLYVECT = eval list ([POLY1, POLY2, POLY2, POLY1];

		
		gbx = substitute(Name Expr (gbe), 	Expr (_YS_), YCOL,
											Expr (_TPY1_), TOPY1,
											Expr (_TPY2_), TOPY2,
											Expr (_YVECTOR_), POLYVECT,
											Expr (_TXTC1_), TEXTCOL1,
											Expr (_TXTC2_), TEXTCOL2,
											Expr (_P1_), PVAL1,
											Expr (_P2_), PVAL2,
											Expr (_R1_), R1,
											Expr (_R2_), R2
			);
			
		gb = Eval (gbx);
		
		gbr = gb &amp;lt;&amp;lt; report;
		
		Yaxis = gbr [Axis Box (2)];
		
		Yaxis &amp;lt;&amp;lt; Max (YMax);
		Yaxis &amp;lt;&amp;lt; Min (YMin);
		Yaxis &amp;lt;&amp;lt; Inc (round (YRange/9, 1));
		
		gbr &amp;lt;&amp;lt; Set Title (CList [i]);
		
		gbr &amp;lt;&amp;lt; Journal;
		gbr &amp;lt;&amp;lt; close window;
		
	);	&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your help.&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;TS&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 22:00:55 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-gt-Graphic-script-amp-gt-Polygon-gt-Dynamically-assign/m-p/342822#M59192</guid>
      <dc:creator>Thierry_S</dc:creator>
      <dc:date>2023-06-09T22:00:55Z</dc:date>
    </item>
    <item>
      <title>Re: JSL &gt; Graphic script &amp;gt; Polygon &gt; Dynamically assign coordinates</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-gt-Graphic-script-amp-gt-Polygon-gt-Dynamically-assign/m-p/342872#M59201</link>
      <description>After digging a bit more, I realized that I needed to use the List format for the polygon (i.e. Polygon ({x1,y1}, {x1,y2}, {x2,y2}, {x2,y1}) coordinates and not the Matrix format&lt;BR /&gt;&lt;BR /&gt;Best,&lt;BR /&gt;TS</description>
      <pubDate>Thu, 17 Dec 2020 21:47:14 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-gt-Graphic-script-amp-gt-Polygon-gt-Dynamically-assign/m-p/342872#M59201</guid>
      <dc:creator>Thierry_S</dc:creator>
      <dc:date>2020-12-17T21:47:14Z</dc:date>
    </item>
  </channel>
</rss>

