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 move from signal modeling to system modeling at the first JMP Aerospace Analytics webinar. Register. June 18, 1 p.m. US Eastern Time.

Discussions

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

Plotting Functions in Graph Builder

Trying to plot some functions vs date in graph builder and I get a stepped appearance.  JMP 11 or 12.  Any way to smooth out the curves?  These are bio-rhythms, by the way.

9132_br.png

Here's the code:

dt = New Table( "BR-2015", Add Rows( 2 ),

    New Column( "Date", Numeric, Continuous, Format( "ddMonyyyy", 18 ),

        Input Format( "ddMonyyyy" ),

        Set Values( [3502915200, 3518467200] ) ),

    New Column( "Physical", Numeric, Continuous, Format( "Best", 12 ),

        Formula( bd1 = Parse Date( "01Jan1976" ); t1 = Date Difference( bd1, :Date, "Day" );

        Sin( (2 * 3.14159 * t1) / 23 ); ) ),

    New Column( "Emotional", Numeric, Continuous, Format( "Best", 12 ),

        Formula( bd2 = Parse Date( "01Jan1976" ); t2 = Date Difference( bd2, :Date, "Day" );

        Sin( (2 * 3.14159 * t2) / 28 ); ) ),

    New Column( "Intellectual", Numeric, Continuous, Format( "Best", 12 ),

        Formula( bd3 = Parse Date( "01Jan1976" ); t3 = Date Difference( bd3, :Date, "Day" );

        Sin( (2 * 3.14159 * t3) / 33 ); ) ),

    New Column( "Composite", Numeric, Continuous, Format( "Best", 12 ),

        Formula( :Physical + :Emotional + :Intellectual ) )

);

// Plot formulas as functions

dt << Graph Builder(

    Size( 739, 500 ),

    Show Control Panel( 0 ),

    Variables(

        X( :Date ),

        Y( :Physical ),

        Y( :Emotional, Position( 1 ) ),

        Y( :Intellectual, Position( 1 ) ),

        Y( :Composite, Position( 1 ) )

    ),

    Elements( Formula( X, Y( 1 ), Y( 2 ), Y( 3 ), Y( 4 ), Legend( 3 ) ) )

);

1 ACCEPTED SOLUTION

Accepted Solutions
Jeff_Perkinson
Community Manager Community Manager

Re: Plotting Functions in Graph Builder

In this case the step function is caused by your function which has a built-step at each day because of your Date Difference().

Change the increment for Date Difference to "Hour" and divide by (23*24) you'll get a smoother version. I've only done the Physical for this example.

9114_Pasted_Image_6_29_15__5_22_PM.png


dt =New Table("BR-2015", Add Rows(2),


    New Column( "Date", Numeric, Continuous, Format( "ddMonyyyy", 18 ),


        Input Format( "ddMonyyyy" ),


        Set Values( [3502915200, 3518467200] ) ),


    New Column( "Physical", Numeric, Continuous, Format( "Best", 12 ),


        Formula( bd1 = Parse Date( "01Jan1976" ); t1 = Date Difference( bd1, :Date, "Hour" );


        Sin( (2 * 3.14159 * t1) / (23*24) ); ) ),


    New Column( "Emotional", Numeric, Continuous, Format( "Best", 12 ),


        Formula( bd2 = Parse Date( "01Jan1976" ); t2 = Date Difference( bd2, :Date, "Day" );


        Sin( (2 * 3.14159 * t2) / 28 ); ) ),


    New Column( "Intellectual", Numeric, Continuous, Format( "Best", 12 ),


        Formula( bd3 = Parse Date( "01Jan1976" ); t3 = Date Difference( bd3, :Date, "Day" );


        Sin( (2 * 3.14159 * t3) / 33 ); ) ),


    New Column( "Composite", Numeric, Continuous, Format( "Best", 12 ),


        Formula( :Physical + :Emotional + :Intellectual ) )


);



// Plot formulas as functions


dt << Graph Builder(


    Size( 739, 500 ),


    Show Control Panel( 0 ),


    Variables(


        X( :Date ),


        Y( :Physical ),


        Y( :Emotional, Position( 1 ) ),


        Y( :Intellectual, Position( 1 ) ),


        Y( :Composite, Position( 1 ) )


    ),


    Elements( Formula( X, Y( 1 ), Y( 2 ), Y( 3 ), Y( 4 ), Legend( 3 ) ) )


);


-Jeff

View solution in original post

2 REPLIES 2
Jeff_Perkinson
Community Manager Community Manager

Re: Plotting Functions in Graph Builder

In this case the step function is caused by your function which has a built-step at each day because of your Date Difference().

Change the increment for Date Difference to "Hour" and divide by (23*24) you'll get a smoother version. I've only done the Physical for this example.

9114_Pasted_Image_6_29_15__5_22_PM.png


dt =New Table("BR-2015", Add Rows(2),


    New Column( "Date", Numeric, Continuous, Format( "ddMonyyyy", 18 ),


        Input Format( "ddMonyyyy" ),


        Set Values( [3502915200, 3518467200] ) ),


    New Column( "Physical", Numeric, Continuous, Format( "Best", 12 ),


        Formula( bd1 = Parse Date( "01Jan1976" ); t1 = Date Difference( bd1, :Date, "Hour" );


        Sin( (2 * 3.14159 * t1) / (23*24) ); ) ),


    New Column( "Emotional", Numeric, Continuous, Format( "Best", 12 ),


        Formula( bd2 = Parse Date( "01Jan1976" ); t2 = Date Difference( bd2, :Date, "Day" );


        Sin( (2 * 3.14159 * t2) / 28 ); ) ),


    New Column( "Intellectual", Numeric, Continuous, Format( "Best", 12 ),


        Formula( bd3 = Parse Date( "01Jan1976" ); t3 = Date Difference( bd3, :Date, "Day" );


        Sin( (2 * 3.14159 * t3) / 33 ); ) ),


    New Column( "Composite", Numeric, Continuous, Format( "Best", 12 ),


        Formula( :Physical + :Emotional + :Intellectual ) )


);



// Plot formulas as functions


dt << Graph Builder(


    Size( 739, 500 ),


    Show Control Panel( 0 ),


    Variables(


        X( :Date ),


        Y( :Physical ),


        Y( :Emotional, Position( 1 ) ),


        Y( :Intellectual, Position( 1 ) ),


        Y( :Composite, Position( 1 ) )


    ),


    Elements( Formula( X, Y( 1 ), Y( 2 ), Y( 3 ), Y( 4 ), Legend( 3 ) ) )


);


-Jeff
pmroz
Super User

Re: Plotting Functions in Graph Builder

Thanks Jeff that works great. 

Recommended Articles