cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar

Scaling y-axis for multiple plots in bivariate fit report output

Hello all, 
 
I am creating a bivariate plot via a small script and I need to scale the y-axis to log scale for all the plots in the report. The number of plots can change depending on the dataset. However, with the following script, I am unable to scale the y-axis even for one plot.
 
Thanks!
biv = Bivariate(
	SendToByGroup(Bygroup Default),
	Y(:y_value),
	X(:x_value),
	By(:VAR1, VAR2, VAR3),
	Fit Special(yTran("Log"))
);
 
Report(biv)[AxisBox(1)] << {Scale("Log")};
1 ACCEPTED SOLUTION

Accepted Solutions
SDF1
Super User

Re: Scaling y-axis for multiple plots in bivariate fit report output

Hi @CircularPuppy35 ,

 

  I think the problem might start with the fact that your report(biv) variable has multiple elements to it. If you look through the code below where I use the Big Class.jmp file and use :sex and :age as BY variables, you can see that the variable rbiv has 12 elements in it, and you need to access the ith element first, with something like rbiv[i]. See the code below. And, if you just loop through however many elements there are in rbiv, it'll change the Y-axis to all be Log. 

Names Default To Here( 1 );

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

biv = Bivariate( Y( :height ), X( :weight ), By( :sex, :age ), Fit Special( yTran( "Log" ) ) );

rbiv = biv << report;
For( i = 1, i <= N Items( rbiv ), i++,
	rbiv[i][Outline Box( 1 )][Axis Box( 1 )] << {Scale( "Log" )}
);

Hope this helps!,

DS

View solution in original post

3 REPLIES 3
SDF1
Super User

Re: Scaling y-axis for multiple plots in bivariate fit report output

Hi @CircularPuppy35 ,

 

  I think the problem might start with the fact that your report(biv) variable has multiple elements to it. If you look through the code below where I use the Big Class.jmp file and use :sex and :age as BY variables, you can see that the variable rbiv has 12 elements in it, and you need to access the ith element first, with something like rbiv[i]. See the code below. And, if you just loop through however many elements there are in rbiv, it'll change the Y-axis to all be Log. 

Names Default To Here( 1 );

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

biv = Bivariate( Y( :height ), X( :weight ), By( :sex, :age ), Fit Special( yTran( "Log" ) ) );

rbiv = biv << report;
For( i = 1, i <= N Items( rbiv ), i++,
	rbiv[i][Outline Box( 1 )][Axis Box( 1 )] << {Scale( "Log" )}
);

Hope this helps!,

DS

Re: Scaling y-axis for multiple plots in bivariate fit report output

Thanks a lot. This worked seamlessly. Appreciate the help!

jthi
Super User

Re: Scaling y-axis for multiple plots in bivariate fit report output

Using By variable will return a list of objects, so you have to manage that (loop over those elements or send a message to whole list). Below is example which might work when sending a message to the list (I usually use XPath() not Find(), but in this case Find() seemed much simpler)

Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");
bivs = dt << Bivariate(
	SendToByGroup(Bygroup Default),
	Y(:Weight),
	X(:Height),
	By(:age, :sex),
	Fit Special(yTran("Log"))
);

show(bivs); // list of bivariates
// You have to either loop over the list or send a message to the list

(bivs << Find(AxisBox(1))) << Scale("Log");
-Jarmo