BookmarkSubscribe
lakepotter
Community Trekker

How do I standardize axis scale (log) for all graphs generated from a looped script?

I'm trying to write a simple script that loops over columns and iteratively uses each column as the Y values in a plot. I think I've got the for loop down but I can't get the Y axis set to a log scale. The code runs but each graph that is generated is on a linear scale with a range that is specific for each column.  I'd like each graph to be on a log scale (either with a specifically set min/max or an automatically generated range based on the data). 

 

cd = Current Data Table();
column_names = cd << Get Column Names;

For ( i = 256, i <= 258, i++, 

Graph Builder(
	Size( 625, 660 ),
	Variables(
		X( :Day ),
		Y( Column( cd, column_names[i] ) ),
		Overlay( :Dose ),
	),
	Elements( Line( X, Y, Legend( 6 ) , Error Bars ("Standard Deviation") ) ),
	SendToReport(
		Dispatch(
			{},
			"Data Abs. Counts T CD56br" ,
			ScaleBox,
			{Scale( "Log" ), Format( "Best", 12), Min( 0.002 ), Max( 16000 ),
			Inc( 1 ), Minor Ticks( 1 ), Label Row( Show Minor Labels( 0 ) )}
		),
		Dispatch(
			{},
			"400",
			ScaleBox,
			{Legend Model(
				6,
				Properties( 0, {Line Width( 2 )} ),
				Properties( 1, {Line Width( 2 )} ),
				Properties( 2, {Line Width( 2 )} ),
				Properties( 3, {Line Width( 2 )} ),
				Properties( 4, {Line Width( 2 )} )
			)}
		),
		Dispatch(
			{},
			"Y title",
			TextEditBox,
			{Set Text( Column(cd, column_names[i]))}
		)
	)
))

 

I have read https://community.jmp.com/t5/Discussions/Scripting-Y-Axis-to-be-Log-scale/m-p/54573#M30852 and am still stuck. I tried including ScaleBox(1) or ScaleBox(2) but couldn't even get the first or second graphs to be on a log scale. I am also trying the xPath solution but additional help would be great. 

 

Thanks so much!!

 

Bonus question: 

SendToReport(
		Dispatch(
			{},
			"Data Abs. Counts T CD56br" ,

What is the "Data Abs. Counts T CD56br" refering to here? That's one of my column names (but not ALL of the column names!) that got copied/pasted and kept.  It seems to be running the way it should (aside from the scale thing) and changing it to other values (ie. "data") doesn't seem to break anything. What is this? 

 

 

0 Kudos
1 ACCEPTED SOLUTION

Accepted Solutions
lakepotter
Community Trekker

Re: How do I standardize axis scale (log) for all graphs generated from a looped script?

Actually, it turns out my problem really was the BONUS question. I had to change that name to char(column_names[i]) so that the following specs would apply to *that* graph. 

 

So code that works is: 

 

cd = Current Data Table();
column_names = cd << Get Column Names;

For ( i = 255, i <= 256, i++, 
gb = Graph Builder(
	Size( 625, 660 ),
	Variables(
		X( :Day ),
		Y( Column( cd, column_names[i] ) ),
		Overlay( :Patient ),
		Color( :Dose )
	),
	Elements( Line( X, Y, Legend( 6 ) ) ),
	SendToReport(
		Dispatch(
			{},
			Char(column_names[i]),
			ScaleBox,
			{Scale( "Log" ), Format( "Best", 12 ), Min( 0.002 ), Max( 16000 ),
			Inc( 1 ), Minor Ticks( 1 ), Label Row( Show Minor Labels( 0 ) )}
		),
		Dispatch(
			{},
			"400",
			ScaleBox,
			{Legend Model(
				6,
				Properties( 0, {Line Width( 2 )} ),
				Properties( 1, {Line Width( 2 )} ),
				Properties( 2, {Line Width( 2 )} ),
				Properties( 3, {Line Width( 2 )} ),
				Properties( 4, {Line Width( 2 )} )
			)}
		),
		Dispatch(
			{},
			"Y title",
			TextEditBox,
			{Set Text( Column(cd, column_names[i]) )}
		)
	)
);

rgb = gb << report;

rgb << journal; 
	
);

0 Kudos
1 REPLY 1
lakepotter
Community Trekker

Re: How do I standardize axis scale (log) for all graphs generated from a looped script?

Actually, it turns out my problem really was the BONUS question. I had to change that name to char(column_names[i]) so that the following specs would apply to *that* graph. 

 

So code that works is: 

 

cd = Current Data Table();
column_names = cd << Get Column Names;

For ( i = 255, i <= 256, i++, 
gb = Graph Builder(
	Size( 625, 660 ),
	Variables(
		X( :Day ),
		Y( Column( cd, column_names[i] ) ),
		Overlay( :Patient ),
		Color( :Dose )
	),
	Elements( Line( X, Y, Legend( 6 ) ) ),
	SendToReport(
		Dispatch(
			{},
			Char(column_names[i]),
			ScaleBox,
			{Scale( "Log" ), Format( "Best", 12 ), Min( 0.002 ), Max( 16000 ),
			Inc( 1 ), Minor Ticks( 1 ), Label Row( Show Minor Labels( 0 ) )}
		),
		Dispatch(
			{},
			"400",
			ScaleBox,
			{Legend Model(
				6,
				Properties( 0, {Line Width( 2 )} ),
				Properties( 1, {Line Width( 2 )} ),
				Properties( 2, {Line Width( 2 )} ),
				Properties( 3, {Line Width( 2 )} ),
				Properties( 4, {Line Width( 2 )} )
			)}
		),
		Dispatch(
			{},
			"Y title",
			TextEditBox,
			{Set Text( Column(cd, column_names[i]) )}
		)
	)
);

rgb = gb << report;

rgb << journal; 
	
);

0 Kudos