cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
mikedriscoll
Level VI

Refresh axis for Graph Builder

Hi, Is there a way to refresh a graph builder axis using jsl?  The last line in my code (...<max()<<min();// ) is resulting in multiple values on an axis, see vertical axis in attached picture.

 

I use the setwidth(0) on distribution for cases where I end up needing to reset the axis width based on number of digits. setwidth(0) sets it automatically. i'm not sure how much it helps on graph builder.

 

I'm hoping there's an automatic way to adjust it, otherwise I can play with minor ticks and inc().

 

My code does something like this but I haven't been able to distill my code/tables down to a shareable and reproducible version.

 

Clear Log();
Names Default To Here( 1 );


dtData = open( "$SAMPLE_DATA\Body Measurements.jmp");

myList = {};
for(i=1,i<=nrows(dtData),i++, myList[i] = mod(i-1,5)+1);
dtData << newcolumn("xaxis", Numeric, "Nominal", values(myList));

for(i=1,i<=nrows(dtData),i++, myList[i] = floor((i-1)/5)+1);
dtData << newcolumn("overlay", Numeric, "Nominal", values(myList));

gbObj= Graph Builder(
	size(350,350),
	show control panel (0),
	Variables( X( :xaxis ), Y( :Mass ), Overlay( :overlay ), color(:overlay) ),
	Elements(
		Line( X, Y, Legend( 4 ), Row order( 0 ) )
	)
);

gbOlbXpObj = gbObj << xpath( "//OutlineBox[ text() = 'Graph Builder']//AxisBox");
gbOlbXpObj[2] <<  max(101.6589)<<  min(55) << setwidth(0);// << inc(myInc);

Screencap.jpg

 

Thanks,

Mike

 

 

7 REPLIES 7
David_Burnham
Super User (Alumni)

Re: Refresh axis for Graph Builder

For what it is worth, below is some code that reproduces the problem.  Well, in spirit.  When the code runs it creates a strange looking y-axis:

 

strange.PNG

 

Not the same problem that you have but a formatting problem nontheless, and one that is probably fixed in the same way that you are asking for:

use the grabber tool to give it a tiny nudge (this is what I think you mean by 'refresh'):

 

strange-nomore.PNG

 

Here is the code that reproduces the above output (sorry for ther embedded table).  Different code, but I kept your last line :)

 

New Table( "Square Well",
	Add Rows( 401 ),
	New Script(
		"Graph Builder",
		Graph Builder(
			Size( 382, 300 ),
			Show Control Panel( 0 ),
			Variables( X( :t ), Y( :F ) ),
			Elements( Line( X, Y, Legend( 9 ) ) ),
			SendToReport(
				Dispatch(
					{},
					"t",
					ScaleBox,
					{Format( "Best", 12 ), Min( 3 ), Max( 3.8 ), Inc( 0.1 ),
					Minor Ticks( 0 ), Label Row( Show Major Grid( 1 ) )}
				),
				Dispatch(
					{},
					"F",
					ScaleBox,
					{Min( 50 ), Max( 200 ), Inc( 50 ), Minor Ticks( 1 ),
					Label Row( {Show Major Grid( 1 ), Show Minor Grid( 1 )} )}
				),
				Dispatch( {}, "400", LegendBox, {Position( {-1} )} ),
				Dispatch( {}, "Graph Builder", FrameBox, {Marker Size( 0 )} )
			)
		)
	),
	New Column( "t",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values(
			[-20, -19.9, -19.8, -19.7, -19.6, -19.5, -19.4, -19.3, -19.2, -19.1, -19,
			-18.9, -18.8, -18.7, -18.6, -18.5, -18.4, -18.3, -18.2, -18.1, -18,
			-17.9, -17.8, -17.7, -17.6, -17.5, -17.4, -17.3, -17.2, -17.1, -17,
			-16.9, -16.8, -16.7, -16.6, -16.5, -16.4, -16.2999999999999,
			-16.1999999999999, -16.0999999999999, -15.9999999999999,
			-15.8999999999999, -15.7999999999999, -15.6999999999999,
			-15.5999999999999, -15.4999999999999, -15.3999999999999,
			-15.2999999999999, -15.1999999999999, -15.0999999999999,
			-14.9999999999999, -14.9, -14.8, -14.7, -14.6, -14.5, -14.4, -14.3,
			-14.2, -14.1, -14, -13.9, -13.8, -13.7, -13.6, -13.5, -13.4, -13.3,
			-13.2, -13.1, -13, -12.9, -12.8, -12.7, -12.6, -12.5, -12.4, -12.3,
			-12.2, -12.1, -12, -11.9, -11.8, -11.7, -11.6, -11.5, -11.4, -11.3,
			-11.2, -11.1, -11, -10.9, -10.8, -10.7, -10.6, -10.5, -10.4, -10.3,
			-10.2, -10.1, -9.99999999999997, -9.89999999999997, -9.79999999999997,
			-9.69999999999997, -9.59999999999997, -9.49999999999997,
			-9.39999999999997, -9.29999999999997, -9.19999999999997,
			-9.09999999999997, -8.99999999999997, -8.89999999999997,
			-8.79999999999997, -8.69999999999997, -8.59999999999997,
			-8.49999999999997, -8.39999999999997, -8.29999999999997,
			-8.19999999999997, -8.09999999999997, -7.99999999999997,
			-7.89999999999997, -7.79999999999997, -7.69999999999997,
			-7.59999999999997, -7.49999999999997, -7.39999999999997,
			-7.29999999999998, -7.19999999999998, -7.09999999999998,
			-6.99999999999998, -6.89999999999998, -6.79999999999998,
			-6.69999999999998, -6.59999999999998, -6.49999999999998,
			-6.39999999999998, -6.29999999999998, -6.19999999999998,
			-6.09999999999998, -5.99999999999998, -5.89999999999998,
			-5.79999999999998, -5.69999999999998, -5.59999999999998,
			-5.49999999999998, -5.39999999999998, -5.29999999999998,
			-5.19999999999998, -5.09999999999998, -4.99999999999998,
			-4.89999999999998, -4.79999999999998, -4.69999999999998,
			-4.59999999999999, -4.49999999999999, -4.39999999999999,
			-4.29999999999999, -4.19999999999999, -4.09999999999999,
			-3.99999999999999, -3.89999999999999, -3.79999999999999,
			-3.69999999999999, -3.59999999999999, -3.49999999999999,
			-3.39999999999999, -3.29999999999999, -3.19999999999999,
			-3.09999999999999, -2.99999999999999, -2.89999999999999,
			-2.79999999999999, -2.69999999999999, -2.59999999999999,
			-2.49999999999999, -2.39999999999999, -2.29999999999999,
			-2.19999999999999, -2.09999999999999, -1.99999999999999,
			-1.89999999999999, -1.79999999999999, -1.69999999999998,
			-1.59999999999998, -1.49999999999999, -1.39999999999998,
			-1.29999999999998, -1.19999999999998, -1.09999999999998,
			-0.999999999999985, -0.899999999999985, -0.799999999999985,
			-0.699999999999985, -0.599999999999985, -0.499999999999985,
			-0.399999999999985, -0.299999999999985, -0.199999999999985,
			-0.0999999999999847, 1.52933221642115e-14, 0.100000000000015,
			0.200000000000015, 0.300000000000015, 0.400000000000015,
			0.500000000000015, 0.600000000000015, 0.700000000000015,
			0.800000000000015, 0.900000000000015, 1.00000000000002, 1.10000000000002,
			1.20000000000002, 1.30000000000002, 1.40000000000002, 1.50000000000002,
			1.60000000000002, 1.70000000000002, 1.80000000000002, 1.90000000000002,
			2.00000000000002, 2.10000000000002, 2.20000000000002, 2.30000000000002,
			2.40000000000002, 2.50000000000002, 2.60000000000002, 2.70000000000002,
			2.80000000000002, 2.90000000000002, 3.00000000000002, 3.10000000000002,
			3.20000000000002, 3.30000000000002, 3.40000000000002, 3.50000000000002,
			3.60000000000002, 3.70000000000002, 3.80000000000002, 3.90000000000002,
			4.00000000000002, 4.10000000000002, 4.20000000000002, 4.30000000000002,
			4.40000000000002, 4.50000000000002, 4.60000000000002, 4.70000000000002,
			4.80000000000001, 4.90000000000001, 5.00000000000001, 5.10000000000001,
			5.20000000000001, 5.30000000000001, 5.40000000000001, 5.50000000000001,
			5.60000000000001, 5.70000000000001, 5.80000000000001, 5.90000000000001,
			6.00000000000001, 6.10000000000001, 6.20000000000001, 6.30000000000001,
			6.40000000000001, 6.50000000000001, 6.60000000000001, 6.70000000000001,
			6.80000000000001, 6.90000000000001, 7.00000000000001, 7.10000000000001,
			7.20000000000001, 7.30000000000001, 7.40000000000001, 7.50000000000001,
			7.60000000000001, 7.70000000000001, 7.80000000000001, 7.9, 8, 8.1, 8.2,
			8.3, 8.4, 8.5, 8.6, 8.7, 8.8, 8.9, 9, 9.1, 9.2, 9.3, 9.4, 9.5, 9.6, 9.7,
			9.8, 9.9, 10, 10.1, 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 11,
			11.1, 11.2, 11.3, 11.4, 11.5, 11.6, 11.7, 11.8, 11.9, 12, 12.1, 12.2,
			12.3, 12.4, 12.5, 12.6, 12.7, 12.8, 12.9, 13, 13.1, 13.2, 13.3, 13.4,
			13.5, 13.6, 13.7, 13.8, 13.9, 14, 14.1, 14.2, 14.3, 14.4, 14.5, 14.6,
			14.7, 14.8, 14.9, 15, 15.1, 15.2, 15.3, 15.4, 15.5, 15.6, 15.7, 15.8,
			15.9, 16, 16.1, 16.2, 16.3, 16.4, 16.5, 16.6, 16.7, 16.8, 16.9, 17, 17.1,
			17.2, 17.3, 17.4, 17.5, 17.6, 17.7, 17.8, 17.9, 18, 18.1, 18.2, 18.3,
			18.4, 18.5, 18.6, 18.7, 18.8, 18.9, 19, 19.1, 19.2, 19.3, 19.4, 19.5,
			19.6, 19.7, 19.8, 19.9, 20]
		)
	),
	New Column( "F",
		Numeric,
		"Continuous",
		Format( "Fixed Dec", 12, 0 ),
		Formula( (((:t ^ 4 + 3 * :t ^ 3) - 12 * :t ^ 2) + :t) - 6 )
	)
);

gbObj = Graph Builder(
	Size( 382, 300 ),
	Show Control Panel( 0 ),
	Variables( X( :t ), Y( :F ) ),
	Elements( Line( X, Y, Legend( 9 ) ) ),
	SendToReport(
		Dispatch(
			{},
			"t",
			ScaleBox,
			{Format( "Best", 12 ), Min( 3 ), Max( 3.8 ), Inc( 0.1 ),
			Minor Ticks( 0 ), Label Row( Show Major Grid( 1 ) )}
		),
		Dispatch(
			{},
			"F",
			ScaleBox,
			{Min( 50 ), Max( 200 ), Inc( 50 ), Minor Ticks( 1 ),
			Label Row( {Show Major Grid( 1 ), Show Minor Grid( 1 )} )}
		),
		Dispatch( {}, "Graph Builder", FrameBox, {Marker Size( 0 )} ),
		Dispatch(
			{},
			"400",
			LegendBox,
			{Legend Position( {9, [-1]} ), Position( {-1} )}
		)
	)
);
// first time i have seen xpath used to traverse the display tree :)
gbOlbXpObj = gbObj << xpath( "//OutlineBox[ text() = 'Graph Builder']//AxisBox");
gbOlbXpObj[2] <<  max(101.6589)<<  min(55) << setwidth(0);// << inc(myInc);

 

 

 

 

-Dave
mikedriscoll
Level VI

Re: Refresh axis for Graph Builder

Hi Dave

Thanks for the response. The grabber tool to nudge the axis is my present workaround, but my report plots dozens to hundreds of parameters so I'd like to have something polished straight out of the script (programmatic) ... espcially if I'm re-running the script during a presentation.

 

re: xpath and display trees. Xan Gregg talked about it a bit at a supplemental training session at JMP discovery in 2014. I followed up and was pointed to a 2015 poster on the subject, and kind of fumbled my way through it. When working properly it is much more exact about finding the correct node. With complex display trees, the indexes of some display boxes become less predictable (at least, the way I was doing it) and can change depending on when you inspect the display tree.

 

-Mike

David_Burnham
Super User (Alumni)

Re: Refresh axis for Graph Builder

Hi Mike

 

My comment about nudging the axis wasn't to suggest that that was an appropriate solution, just that it is the closest way I could describe what is meant by "refreshing" the axis - as distinct from a reset.  

-Dave
mikedriscoll
Level VI

Re: Refresh axis for Graph Builder

Ah ok, I see what you're saying. yes, that is exactly what I mean by 'refreshing' the axis.

 

-Mike

David_Burnham
Super User (Alumni)

Re: Refresh axis for Graph Builder

Here is another example of the problem:

 

problem.PNG

The axis min and max are set to -3 and +3 respectively with an increment of 1.  This is the element of code for the Graph Builder platform - 

 

		SendToReport(
			Dispatch(
				{},
				"Studentized Residuals",
				ScaleBox,
				{Min( -3 ), Max( 3 ), Inc( 1 ), Minor Ticks( 0 ),
				Add Ref Line( 0, "Dashed", "Black", "", 1 )}
			)
)

 

-Dave
David_Burnham
Super User (Alumni)

Re: Refresh axis for Graph Builder

I've fixed it.  My mistake, the actual code running had an Inc value of 0.5 not 1 - so I guess the repeat values on the axis were due to rounding in the formatting of the numbers

-Dave
mikedriscoll
Level VI

Re: Refresh axis for Graph Builder

I've had problems with and without the inc() part of the command.  One thing I just noticed though, is that JMP12 and 13 handles this much better. I do see more cases like you showed a couple months ago (just 2 ticks for the whole axis) but I don't see any duplicated numbers on JMP12 or 13 for the same data / script file like I had been seeing on JMP11 (all non-pro versions).  I was generally using JMP11 because most of the users at my company are officially on JMP11, but we're switching over to JMP13.

 

My present code is without the inc() command, so I'll leave that out for now. Thanks for your help.

 

-Mike