cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
gandi2223
Level III

Plot 2D Trace

Is it possible to generate a 2D trace in JMP? I.e., plot a list of x/y coordinates, connecting consecutive points with a line, as shown in the attached PNG?

6 REPLIES 6
ian_jmp
Staff

Re: Plot 2D Trace

Something like:

NamesDefaultToHere(1);

n= 10;

x = J(n, 1, RandomInteger(0, 100));

y = J(n, 1, RandomInteger(0, 100));

NewWindow("XY Trace", GraphBox(PenColor("Red"), Line(x,y)));


Look in the JSL Guide or the Scripting Index for more details on the options for 'GraphBox()'. To get values from a column in a table into a matrix send the column a 'GetAsMatrix()' message.

gandi2223
Level III

Re: Plot 2D Trace

Thanks lots!

louv
Staff (Retired)

Re: Plot 2D Trace

I used the Bubble Plot platform...

//Create a table with the drawing points, repeat that origin (start and finish)

drawDT = New Table( "Draw Plot",

  Add Rows( 6 ),

//Set the values for the coordinates to the table

  New Column( "X", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [0, 0.3, 0.7, 1, 0.4, 0] ) ),

  New Column( "Y", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [0, 0.9, 1, 0.1, 0.3, 0] ) ),

  New Column( "Draw Order", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [1, 2, 3, 4, 5, 6] ) )

);

//Create a new window with bubble plot

New Window( "Draw Plot",

//On close of the window, the data table is deleted

  <<on close( Close( drawDT ) ),

  Bubble Plot( X( :X ), Y( :Y ), Time( :Draw Order ), Time Index( 6 ), Trail Bubbles( "All" ), Trail Lines( "All" ), )

);


8065_Screen Shot 2015-02-19 at 7.54.34 PM.png

gandi2223
Level III

Re: Plot 2D Trace

Thanks lots!

Craige_Hales
Super User

Re: Plot 2D Trace

start with a data table

8069_LineTable.PNG

Open graph builder and drag the variables to the axes

8070_GB1.PNG

turn off the points and smoother and turn on the line and select row order

8071_GB2.PNG

click done and save the script (red triangle) if you want to run it again without all the drag-and-drop

8072_GB3.PNG


Graph Builder(


  Show Control Panel( 0 ),


  Variables( X( :x ), Y( :y ) ),


  Elements(


  Line( X, Y, Legend( 3 ), Row order( 1 ), Summary Statistic( "Mean" ) )


  )


)



repeat the first point to close the loop if desired.

8073_GB4.PNG

Craige
gandi2223
Level III

Re: Plot 2D Trace

Thanks lots!