Subscribe Bookmark RSS Feed

How to set X axis range in JSL

mws314

Community Member

Joined:

Jan 9, 2015

I am doing a non linear fit model that has 7 data points that always range from 500 to 1700.  The plots show up with the X axis as being from -250 to 1750.  How can I set the x axis to be 540 to 1750?  I have tried by accessing the axis box(2) and ScaleBox but the log always says that it cannot find it.  Here is what I currently have.

dt << New Column( "Model", formula( Parameter( {L = 850, D = 4000, U =0.1}, (((1 - U) / 2) * (cos(pi()*(:BarLength / L)) + 1) + U) * exp(-1*(:BarLength / D)))));

dt << Select Where( :SiteColumn == "J" ) << Exclude << Hide;

    titlex = wf || "_PSPP_FIT";

    MES1 = New Window( titlex,

        nl = dt << Nonlinear(

            Y( :NormTrans ),

            X( :Model ),

            xaxis = nl[axis box( 2 )],

            xaxis << Axis Settings(Max(1750), Min(450)),

            Parameter Bounds( L( 500, 1300 ), D( 200, 20000 ), U( 0, 1 ) ),

            By( :FlashField, :ReqWaveLn ),

            SendToReport(

                Dispatch( {}, "Control Panel", OutlineBox, {Close( 1 )} ),

                Dispatch( {"Plot"}, "1" , ScaleBox,{Min( 450 ), Max( 1750 ), Inc( 500 ), Minor Ticks( 1 )})

                //Dispatch( {}, "1", ScaleBox, {Inc( 250 ), Minor Ticks( 1 )} )

                //Dispatch( {}, "1", axis box(2), {Min( 450 ), Max( 1750 ), Inc( 250 ), Minor Ticks( 1 )} )

                //Dispatch( {"Plot"}, "Nonlinear Graph", FrameBox, {Frame Size( 378, 262 )} ),

                //Dispatch( {}, "Solution", OutlineBox, {Close( 1 )} )

            )

        );

        nl << finish;

    );

What is weird is if I manually adjust the axis and then copy the script it shows up exactly how it shows above.  Manually changing the axis on one of the plots and copying the script shows as this:

Nonlinear(

    Y( :NormTrans ),

    X( :Model ),

    Parameter Bounds( L( 500, 1300 ), D( 200, 20000 ), U( 0, 1 ) ),

    Newton,

    Finish,

    Where( :FlashField == "CF1" & :ReqWaveLn == 769.1172 ),

    SendToReport(

        Dispatch( {}, "Control Panel", OutlineBox, {Close( 1 )} ),

        Dispatch(

            {"Plot"},

            "1",

            ScaleBox,

            {Min( 450 ), Max( 1750 ), Inc( 500 ), Minor Ticks( 1 )}

        )

    )

)

2 REPLIES
David_Burnham

Super User

Joined:

Jul 13, 2011

Just a guess ....

Try putting a comma at the end of this line:

Dispatch( {"Plot"}, "1" , ScaleBox,{Min( 450 ), Max( 1750 ), Inc( 500 ), Minor Ticks( 1 )})

-Dave
michael_jmp

Staff

Joined:

Jun 23, 2011

I'm not able to reproduce the initial Nonlinear plot having such a wide range for the X axis, but my guess is that some of the X values for :SiteColumn=="J" are negative. If that is the case, then the axis minimum is based on the negative values, even though they are hidden and excluded.

I would recommend moving the xaxis statements outside of the Nonlinear() platform call, as I don't think that display box messages such as these are valid within a platform call:

xaxis = report(nl)[axis box( 2 )];

xaxis << Axis Settings( Max( 1750 ), Min( 450 ) );

Also, notice that the axis box is a subscript of report(nl) rather than nl. The Axis Box is in the report layer, rather than the platform layer.

At least in the toy example data that I made up to test this, I was able to remove all of the Send To Report Dispatch() part of your script and just use the two xaxis statements above to get the X axis range to be 450 to 1750.

Let me know if that works for you or if you still see a wide X axis range.

Thanks,
Michael

Michael Crotty
Sr Statistical Writer
JMP Development