cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Image to Table JMP extension imports single or batch images as data tables. Useful to extract curves from pictures or convert image data to curve data to use in analyses like Functional Data Explorer. Download and install the extension.

Discussions

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

How do I change the number of decimals shown in a formula in a graph?

Hi all
I want to change the format of the decimals in a linear formula, shows on a graph, I want only two digits after the decimal

I attached here a picture of the graph that I prepared and the arrow shows the number I want to change
thank you

3 REPLIES 3

Re: How do I change the number of decimals shown in a formula in a graph?

Hi @Efrat_Schwartz ,

It seems that you need to use JSL to change the format of the numbers in the equation.
Here is a sample code. I hope it helps.

Names Default To Here( 1 );
decimal_point = 2; // Please change here

rpt = current report();
frame_box_list =  rpt << xpath( "//FrameBox" );

For( i = 1, i <= N Items( frame_box_list ), i++,
	Try(
		txt_seg = rpt[Framebox( i )] << Find Seg( "TextSeg" );
		TheFormula = txt_seg << Get Text;

		current_intercept = Word( 3, TheFormula, " " );
		Intercept = Format( Num( current_intercept ), "Fixed Dec", decimal_point );
		current_beta1 = Word( 5, TheFormula, " *" );
		Beta1 = Format( Num( current_beta1 ), "Fixed Dec", decimal_point );
		new_formula = Substitute( Eval Expr( TheFormula ),
			Eval Expr( current_intercept ), Eval Expr( Intercept ),
			Eval Expr( current_beta1 ), Eval Expr( beta1 )
		);
		txt_seg << Set Text( new_formula );
	)
);

rpt << reshow;

 

Re: How do I change the number of decimals shown in a formula in a graph?

Thank you

I don't know how to use this JSL?

Regards

Efrat

Re: How do I change the number of decimals shown in a formula in a graph?

Hi @Efrat_Schwartz ,

Thank you for your response.
- First, create a graph using Graph Builder.
- Open the script window via File menu > New > Script.
- Paste the JSL.
- Execute JSL from Edit menu > Run Script
Hope it works.

Recommended Articles