<?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: Automatic Scaling Matching X and Y Axes in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Automatic-Scaling-Matching-X-and-Y-Axes/m-p/762894#M94324</link>
    <description>&lt;P&gt;One option is to use some matrices to check for "valid" rows, get values only from those and then calculate max as before.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1); 

dt = Open("$SAMPLE_DATA/Big Class.jmp");

Column(dt, "height") &amp;lt;&amp;lt; Set Property("Missing Value Codes", {70, 69, 68});
Column(dt, "weight") &amp;lt;&amp;lt; Set Property("Missing Value Codes", {172});

m1 = Column(dt, "height") &amp;lt;&amp;lt; get values;
m2 = Column(dt, "weight") &amp;lt;&amp;lt; get values;

valid_rows = Loc(V Sum(Is Missing(m1 || m2)`), 0);

val = Max(Abs(dt[valid_rows, "weight"] |/ dt[valid_rows, "height"]));&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 07 Jun 2024 16:51:13 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2024-06-07T16:51:13Z</dc:date>
    <item>
      <title>Automatic Scaling Matching X and Y Axes</title>
      <link>https://community.jmp.com/t5/Discussions/Automatic-Scaling-Matching-X-and-Y-Axes/m-p/762305#M94142</link>
      <description>&lt;P&gt;&lt;A href="https://community.jmp.com/t5/Discussions/Automatically-plot-associated-columns/m-p/760888#M93916" target="_blank"&gt;Solved: Re: Automatically plot associated columns - JMP User Community&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As a follow on to the discussion above, I would like to automate the scaling of some plots to be symmetric about the zero value on both the X and Y axes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd like to have this&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Autoscale 1.png" style="width: 564px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/64762i636B44F3169F54CF/image-size/large?v=v2&amp;amp;px=999" role="button" title="Autoscale 1.png" alt="Autoscale 1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;automatically output as this.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Autoscale 2.png" style="width: 564px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/64763i3FABC96F8893475F/image-size/large?v=v2&amp;amp;px=999" role="button" title="Autoscale 2.png" alt="Autoscale 2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The code that got me here is included in the link above&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Slán&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SpannerHead&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jun 2024 13:36:46 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Automatic-Scaling-Matching-X-and-Y-Axes/m-p/762305#M94142</guid>
      <dc:creator>SpannerHead</dc:creator>
      <dc:date>2024-06-03T13:36:46Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic Scaling Matching X and Y Axes</title>
      <link>https://community.jmp.com/t5/Discussions/Automatic-Scaling-Matching-X-and-Y-Axes/m-p/762316#M94148</link>
      <description>&lt;P&gt;Calculate max values (of absolute values), take negative of that and set the values might be one option. You can also calculate the values from data table using Col Max() / Col Min() or Summarize&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(:height), X(:weight));

ms = Report(biv)[FrameBox(1)] &amp;lt;&amp;lt; Find Seg(Marker Seg(1));

xs = ms &amp;lt;&amp;lt; Get X Values;
ys = ms &amp;lt;&amp;lt; Get Y Values;

val = Max(Max(Abs(xs)), Max(Abs(ys)));

xaxis = Report(biv)[AxisBox(1)];
yaxis = Report(biv)[AxisBox(2)];

xaxis &amp;lt;&amp;lt; Min(-1*val) &amp;lt;&amp;lt; Max(val);
yaxis &amp;lt;&amp;lt; Min(-1*val) &amp;lt;&amp;lt; Max(val);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jun 2024 14:17:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Automatic-Scaling-Matching-X-and-Y-Axes/m-p/762316#M94148</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-06-03T14:17:18Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic Scaling Matching X and Y Axes</title>
      <link>https://community.jmp.com/t5/Discussions/Automatic-Scaling-Matching-X-and-Y-Axes/m-p/762323#M94151</link>
      <description>&lt;P&gt;Epic!&amp;nbsp; Works like a charm.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jun 2024 14:39:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Automatic-Scaling-Matching-X-and-Y-Axes/m-p/762323#M94151</guid>
      <dc:creator>SpannerHead</dc:creator>
      <dc:date>2024-06-03T14:39:20Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic Scaling Matching X and Y Axes</title>
      <link>https://community.jmp.com/t5/Discussions/Automatic-Scaling-Matching-X-and-Y-Axes/m-p/762704#M94240</link>
      <description>&lt;P&gt;There is one small thing that I came to realise.&amp;nbsp; In some instances, one of the ys or xs matrices has missing values because it has been given a missing value code.&amp;nbsp; The partner matrix values may not be missing and can be included to set the scales.&amp;nbsp; Is there a way to eliminate values from ys if the row is marked as missing for xs with the same elimination of xs occurring when ys is a missing value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Slán&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SpannerHead&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jun 2024 20:35:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Automatic-Scaling-Matching-X-and-Y-Axes/m-p/762704#M94240</guid>
      <dc:creator>SpannerHead</dc:creator>
      <dc:date>2024-06-05T20:35:11Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic Scaling Matching X and Y Axes</title>
      <link>https://community.jmp.com/t5/Discussions/Automatic-Scaling-Matching-X-and-Y-Axes/m-p/762722#M94246</link>
      <description>&lt;P&gt;What does "marked as missing" mean in this case?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you wish to keep the other value, I think that should still work even if the matrices have missing values.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1717650622005.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/64942iF2B386EDFF0F4EEA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1717650622005.png" alt="jthi_0-1717650622005.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jun 2024 05:11:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Automatic-Scaling-Matching-X-and-Y-Axes/m-p/762722#M94246</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-06-06T05:11:05Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic Scaling Matching X and Y Axes</title>
      <link>https://community.jmp.com/t5/Discussions/Automatic-Scaling-Matching-X-and-Y-Axes/m-p/762872#M94313</link>
      <description>&lt;P&gt;I have a lot of error codes that are numeric to preserve the data type for the column.&amp;nbsp; I need to turn a blind eye to those in the analysis.&amp;nbsp; However, if either X or Y are marked with a missing value code and the partner is not, the scales can be set by data that is not actually plotted on the graph&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="SpannerHead_0-1717772943135.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/64990i5102FED89A82C8E6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SpannerHead_0-1717772943135.png" alt="SpannerHead_0-1717772943135.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thanks for the great help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Slán&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SpannerHead&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2024 15:17:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Automatic-Scaling-Matching-X-and-Y-Axes/m-p/762872#M94313</guid>
      <dc:creator>SpannerHead</dc:creator>
      <dc:date>2024-06-07T15:17:51Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic Scaling Matching X and Y Axes</title>
      <link>https://community.jmp.com/t5/Discussions/Automatic-Scaling-Matching-X-and-Y-Axes/m-p/762874#M94315</link>
      <description>&lt;P&gt;As you know the columns you are using, you can use Col Min + Col Max to get the minimum and maximum values (they should respect Missing Value Codes). Then use combination of your values, Abs() function and Max() function to get your value to use for x and y axis&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1); 

dt = Open("$SAMPLE_DATA/Big Class.jmp");

show(Col Max(Column(dt, "height")));
Column(dt, "height") &amp;lt;&amp;lt; Set Property("Missing Value Codes", {70, 69, 68});
show(Col Max(Column(dt, "height")));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;but I also think that Bivariate shouldn't plot those points at all if they have been ignored by Missing Value Codes&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(:height), X(:weight));
ms = Report(biv)[FrameBox(1)] &amp;lt;&amp;lt; Find Seg(Marker Seg(1));
xs = ms &amp;lt;&amp;lt; Get X Values;
ys = ms &amp;lt;&amp;lt; Get Y Values;
val1 = Max(Max(Abs(xs)), Max(Abs(ys)));
biv &amp;lt;&amp;lt; close window;

Column(dt, "weight") &amp;lt;&amp;lt; Set Property("Missing Value Codes", {172});
biv = dt &amp;lt;&amp;lt; Bivariate(Y(:height), X(:weight));
ms = Report(biv)[FrameBox(1)] &amp;lt;&amp;lt; Find Seg(Marker Seg(1));
xs = ms &amp;lt;&amp;lt; Get X Values;
ys = ms &amp;lt;&amp;lt; Get Y Values;
val2 = Max(Max(Abs(xs)), Max(Abs(ys)));

show(val1, val2);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 07 Jun 2024 15:26:17 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Automatic-Scaling-Matching-X-and-Y-Axes/m-p/762874#M94315</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-06-07T15:26:17Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic Scaling Matching X and Y Axes</title>
      <link>https://community.jmp.com/t5/Discussions/Automatic-Scaling-Matching-X-and-Y-Axes/m-p/762890#M94321</link>
      <description>&lt;P&gt;Thanks and you are right with what you say, I think I'm not expressing the question properly.&amp;nbsp; Missing values in X are ignored when figuring out the maximum of X.&amp;nbsp; The partner Y values on the same row are not missing and therefore not ignored.&amp;nbsp; I should clarify that I'm iterating through columns in a data table and automatically plotting metrics that are connected.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This script might pick a voltage threshold and plot it against the respective current value if that gets selected.&amp;nbsp; When this rescales at the end a missing value in X for example will cause there to be no data point on the graph, however, the partner Y value could still set the scale of the graph.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To ensure the plot contains the 100 value on both axed, I did modify the matrix to include 110 with&amp;nbsp;&lt;CODE class=" language-jsl"&gt;|/110;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Slán&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Spannerhead&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Current Data Table();
dt &amp;lt;&amp;lt; Clear Column Selection();
colList = dt &amp;lt;&amp;lt; get column names( string );
check_list = {"VTX", "VTN", "VTP", "VTF", "IDS", "IBB", "ILK", "CMI"};
New Window( "Select Variables",
	&amp;lt;&amp;lt;Type( "Modal Dialog" ),
	&amp;lt;&amp;lt;On Validate( window:validated ),
	window:enable function = Function( {},
		{Default Local},
		X = window:lbMajor &amp;lt;&amp;lt; Get Selected;
		Y = window:lbMinor &amp;lt;&amp;lt; Get Selected;
		If( N Items( X ) &amp;amp; N Items( Y ) &amp;amp; X != Y,
			window:validated = 1,
			window:validated = 0
		);
		window:ok button &amp;lt;&amp;lt; Enable( window:validated );
	);
	H List Box(
		V List Box(
			Text Box( "Select X Variable" ),
			window:lbMajor = List Box(
				check_list,
				&amp;lt;&amp;lt;Set Max Selected( 1 ),
				enable function
			)
		),
		V List Box(
			Text Box( "Select Y Variable" ),
			window:lbMinor = List Box(
				check_list,
				&amp;lt;&amp;lt;Set Max Selected( 1 ),
				enable function
			)
		)
	);,
	H List Box(
		window:ok button = Button Box( "OK",
			X = window:lbMajor &amp;lt;&amp;lt; Get Selected;
			Y = window:lbMinor &amp;lt;&amp;lt; Get Selected;
			If( N Items( X ) &amp;amp; N Items( Y ) &amp;amp; X != Y,
				window:validated = 1,
				window:validated = 0
			);
			If( window:validated,
				Print( "Processing with X: " || Char( X ) || ", Y: " || Char( Y ) );
				Window( "Select Variables" ) &amp;lt;&amp;lt; Close Window;
			,
				Beep();
				Show( "Invalid Selection" );
				{window:lbMajor, window:lbMinor} &amp;lt;&amp;lt; Select;
				window:lbMajor &amp;lt;&amp;lt; Inval &amp;lt;&amp;lt; Update Window;
				Wait( 0.25 );
				{window:lbMajor, window:lbMinor} &amp;lt;&amp;lt; DeSelect;
				window:lbMajor &amp;lt;&amp;lt; Inval &amp;lt;&amp;lt; Update Window;
				Wait( 0.25 );
				{window:lbMajor, window:lbMinor} &amp;lt;&amp;lt; Select;
				window:lbMajor &amp;lt;&amp;lt; Inval &amp;lt;&amp;lt; Update Window;
				Wait( 0.25 );
				{window:lbMajor, window:lbMinor} &amp;lt;&amp;lt; DeSelect;
				window:lbMajor &amp;lt;&amp;lt; Inval &amp;lt;&amp;lt; Update Window;
			);,
			&amp;lt;&amp;lt;Enable( 0 )
		),
		Button Box( "Cancel", Throw( "!Canceled Analysis" ) )
	)
);
If(
	X[1] == "VTX", Xparam = "VTX",
	X[1] == "VTN", Xparam = "VTN",
	X[1] == "VTP", Xparam = "VTP",
	X[1] == "IDS", Xparam = "IDS",
	X[1] == "IBB", Xparam = "IBB",
	X[1] == "VTF", Xparam = "VTF",
	X[1] == "ILK", Xparam = "ILK",
	X[1] == "CMI", Xparam = "CMI"
);
If(
	Y[1] == "VTX", Yparam = "VTX",
	Y[1] == "VTN", Yparam = "VTN",
	Y[1] == "VTP", Yparam = "VTP",
	Y[1] == "IDS", Yparam = "IDS",
	Y[1] == "IBB", Yparam = "IBB",
	Y[1] == "VTF", Yparam = "VTF",
	Y[1] == "ILK", Yparam = "ILK",
	Y[1] == "CMI", Yparam = "CMI"
);
Show( Xparam );
Show( Yparam );
For( i = 1, i &amp;lt;= N Cols( dt ), i++,
	If(
		Contains( Munger( Head Name( As Namespace( colList[i] ) ), 0, 3 ), Xparam )
		 &amp;amp; Contains(
			Head Name( As Namespace( colList[i] ) ),
			"% Delta From Target"
		),
		Column( colList[i] ) &amp;lt;&amp;lt; Set Selected( 1 )
	)
);
target = dt &amp;lt;&amp;lt; get selected columns();
found_list = {};
Show( target );
New Window( "Compilation",
	For( j = 1, j &amp;lt;= N Items( target ), j++,
		If(
			Contains(
				Munger( Head Name( As Namespace( target[j] ) ), 0, 3 ),
				Xparam
			),
			Connected = Substitute( Head Name( As Namespace( target[j] ) ),
				Xparam, Yparam
			);
			Insert Into( found_list, Connected );
			Try(
				biv = Bivariate(
					Y( Column( dt, found_list[j] ) ),
					X( Column( dt, target[j] ) ),
					Automatic Recalc( 1 ),
					SendToReport(
						Dispatch(
							{},
							"Bivar Plot",
							FrameBox,
							{Frame Size( 470, 470 ),
							Add Graphics Script(
								2,
								Description( "" ),
								Transparency( 0.5 );
								Pen Color( "Red" );
								Fill Color( "Red" );
								Oval( -100, -100, 100, 100, 1 );
								Pen Color( "Green" );
								Fill Color( "Green" );
								Oval( -90, -90, 90, 90, 1 );
								Pen Color( "Blue" );
								Fill Color( "Blue" );
								Oval( -80, -80, 80, 80, 1 );
								Pen Color( "Black" );
								Line( [-110 0 110], [0 0 0] );
								Line( [0 0 0], [-110 0 110] );
							)}
						)
					)
				);
				ms = Report( biv )[FrameBox( 1 )] &amp;lt;&amp;lt; Find Seg( Marker Seg( 1 ) );
				xs = ms &amp;lt;&amp;lt; Get X Values|/110;
				Show(xs);
				ys = ms &amp;lt;&amp;lt; Get Y Values|/110;
				Show(ys);
				val = Max( Max( Abs( xs ) ), Max( Abs( ys ) ) );
				xaxis = Report( biv )[AxisBox( 1 )];
				yaxis = Report( biv )[AxisBox( 2 )];
				xaxis &amp;lt;&amp;lt; Min( -1 * val ) &amp;lt;&amp;lt; Max( val );
				yaxis &amp;lt;&amp;lt; Min( -1 * val ) &amp;lt;&amp;lt; Max( val );
			);
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 07 Jun 2024 16:43:06 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Automatic-Scaling-Matching-X-and-Y-Axes/m-p/762890#M94321</guid>
      <dc:creator>SpannerHead</dc:creator>
      <dc:date>2024-06-07T16:43:06Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic Scaling Matching X and Y Axes</title>
      <link>https://community.jmp.com/t5/Discussions/Automatic-Scaling-Matching-X-and-Y-Axes/m-p/762894#M94324</link>
      <description>&lt;P&gt;One option is to use some matrices to check for "valid" rows, get values only from those and then calculate max as before.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1); 

dt = Open("$SAMPLE_DATA/Big Class.jmp");

Column(dt, "height") &amp;lt;&amp;lt; Set Property("Missing Value Codes", {70, 69, 68});
Column(dt, "weight") &amp;lt;&amp;lt; Set Property("Missing Value Codes", {172});

m1 = Column(dt, "height") &amp;lt;&amp;lt; get values;
m2 = Column(dt, "weight") &amp;lt;&amp;lt; get values;

valid_rows = Loc(V Sum(Is Missing(m1 || m2)`), 0);

val = Max(Abs(dt[valid_rows, "weight"] |/ dt[valid_rows, "height"]));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 07 Jun 2024 16:51:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Automatic-Scaling-Matching-X-and-Y-Axes/m-p/762894#M94324</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-06-07T16:51:13Z</dc:date>
    </item>
  </channel>
</rss>

