cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Discussions

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

Custom scales in Graph Builder?

Some analyses require an axis scale that is not available by default in Graph Builder - like  Arrhenius plots with Temperature plotted as 1/T [K].

hogi_0-1761667988302.png


Let's start with the example from the Scripting Index. We want to generate a Log plot manually - and learn from it:

Names Default To Here( 1 );
Open( "$sample_data/big class.jmp" );
gb = Graph Builder(
	Variables( X( :height ), Y( :height ) ),
	Elements( Points( X, Y, Legend( 2 ) ), Smoother( X, Y, Legend( 1 ) ) ),
	SendToReport(
		Dispatch( {}, {:height}, ScaleBox( 2 ),
			{Scale( "Log" ), Max( 1000 ), Minor Ticks( 1 ),
			Label Row( Show Minor Grid( 1 ) )}
		)
	)
);
gbr = Report( gb );
gbr[axisbox( 1 )] << scale(
	custom scale,
	Scale To Internal( Function( {x}, If( x > 0, Log( x, 2 ), . ) ) ),
	Scale To External( Function( {x}, Power( 2, x ) ) )
) << Min( 32 ) << Max( 100 );

 

There is a function Scale to Internal() which is used to apply the log() to the X axis - and a Scale to External() which is the inverse function.

After executing the code ...

a)  the user get a log scale on the X axis (compare with the default Log scale on the Y axis):
[add some data points @ 200, 500 , ...]

hogi_4-1761670027446.png

... in addition:
b)  Custom Scale appears in the axis menu

hogi_1-1761668396360.png

c) ... and the user gets access to Cube Root and Johnson Su scale.


In analogy to the previous example, one can use 

current report()[axisbox( 1 )] << scale(
	custom scale,
	Scale To Internal( Function( {x}, if (x>-273, 1/(x+273)) ) ),
	Scale To External( Function( {x}, if (x>0,1/x-273)) ) 
) << Min( 30 ) << Max( 100 ) << Inc(2);

... to plot Temperature [°C] on a 1/K scale :)

hogi_0-1761670774224.png

and with

hogi_1-1761671084396.png
one gets:

hogi_0-1761671064758.png

 

 

Questions:

  • where can I find a documentation of the functionality.

  • the  If() in the Scale To External functions can restrict the range.
    further applications besides "make it work"?

  • I noticed a strange interplay of  Scale to Internal / External()when both functions were not inverse of each other.
    So, is it mandatory to use inverse functions? Are there interesting applications for non-inverse functions?

  • What is the definition of Inc()? Min() and Max() are defined in the original dimension [e.g. °C],
    Inc() 
    is not defined in this dimension - nor in the "internal dimension".

  • Adjusting the tick spacing is troublesome - dragging the axis a bit to far leads to a loss of all ticks or an extreme setting of Inc().
    Why is Inc() not accessible via the GUI?!?

    Workaround:
    change Min/Max with a small range - this reduces Inc(). Then drag the axis to increase the range.

  • Temperature runs from left to right, this is great!!! Nevertheless, besides Reverse order, can I also change   Scale to Internal / External() to make the temperature run from right to left.
1 REPLY 1
hogi
Level XIII

Re: Custom scales in Graph Builder?

The fit curve doesn't fit?

There is no automatic update of the fit after changing the scale.
To trigger the update, change the fit settings and revert to the original settings:

hogi_0-1762174771452.png

 

Recommended Articles