cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Learn how to build custom Python data connectors and further customize JMP’s Data Connector Framework with the Python Data Connector Demo, available now in the JMP Marketplace!
  • See how to create experiments to support product design and ID useful product features. Register for June 12 webinar, 2pm US Eastern Time.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
Abby_Collins14
Level III

Label X-axis in fit y by x platform with different column

Hello, 

 

Is there any easy way to change the x-axis label with a different column in the fit y by x platform? 

 

Thanks!

 

 

3 REPLIES 3
txnelson
Super User

Re: Label X-axis in fit y by x platform with different column

Here is a simple example that draws the graph and then resets the X label to the name of the 2nd column in the data table.

 

names default to here(1);
dt=open("$SAMPLE_DATA/big class.jmp");
Graph Builder(
	Size( 528, 456 ),
	Show Control Panel( 0 ),
	Variables( X( :weight ), Y( :height ) ),
	Elements( Points( X, Y, Legend( 6 ) ), Smoother( X, Y, Legend( 7 ) ) )
);

current report()[texteditbox(3)]<<set text(column(dt,2)<<get name);

txnelson_0-1738689278431.png

 

Jim
Abby_Collins14
Level III

Re: Label X-axis in fit y by x platform with different column

Thanks! I should have made my post more clear. 

 

I am trying to change the entire x-axis label and x values in the fit y by x platform with a different column. Since fitting a regression line requires both numeric/continuous variables, I cannot use Run ID as the x variable as it contains characters, so I was wondering if it is possible to replace the x-axis label/values with a character column after the regression is fit. 

 

Example of data: Run (numeric run number), Run ID (character), regression fit output is what I have using the two numeric columns, but I would like the x-axis to be like the x-axis from the graph builder using Run ID (character). 

 

Thanks for the help!

Abby_Collins14_0-1738695245370.png

Abby_Collins14_1-1738695255129.png

Abby_Collins14_2-1738695261501.png

 

 

mmarchandFSLR
Level VI

Re: Label X-axis in fit y by x platform with different column

I think you want to use Value Labels.  You probably don't want to code them each individually, so....

This is ugly, and I don't like using "Eval( Parse(....) )", but it works.

 

Names Default to Here( 1 );
labs = {};
For Each Row( Insert Into( labs, Char( :Run ) || " = \!"" || :Run ID || "\!"" ) );
Eval( Parse( ":Run << Add Column Properties(
	Value Labels( {" || Concat Items( labs, ", " ) || "} ),
	Use Value Labels( 1 )
)") )

Recommended Articles