cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • We’re improving the Learn JMP page, and want your feedback! Take the survey
  • JMP monthly Newswire gives user tips and learning events. Subscribe
Choose Language Hide Translation Bar
VladimirB
Level II

Graph Builder: connect a subset of points with line segments and show only markers for the other points

Hello,

 

I am trying to use Graph Builder to connect a subset of points with line segments and show only markers for the other points.  So that my plot looks something like this (lines here were added manually in a picture for illustration):

VladimirB_0-1749258697315.png

I tried utilizing a separate column to employ overlay capability and it indeed allows to plots separate lines for separate groups of points.  But I was not able to remove the lines and leave only markers (or the other way around) for a single group of points.

 

In the JMP table I put the points that should be connected with a line as separate 4 points.  Ideally, the last of these 4 points should be connected to the first of these 4 points.

 

The JMP file (JMP 18, regular version, not PRO) is attached.

Any suggestions or comments are greatly appreciated.

 

Thank you!

              Vladimir

3 ACCEPTED SOLUTIONS

Accepted Solutions
txnelson
Super User

Re: Graph Builder: connect a subset of points with line segments and show only markers for the other points

txnelson_0-1749265454891.png

I produced this interactively

  1. I added an additional Overlay Row to the data table to add the connecting line to finish where it startedtxnelson_1-1749265723839.png

     

  2. I then dragged the Overlay_column to the color drop box
  3. I then added a Line to the graph which displayed 2 lines                      txnelson_2-1749265977611.png

     

  4. I didn't want the black line so I simply set the line color for the black line to whitetxnelson_3-1749266123754.png

     

  5. That left the markers for the points for the non overlay data looking funny.  This is because the former black line is displayed on top of the points.
  6. To move the black points to be displayed on top of the now white (invisible to the user_ lines, I right clicked on the graph and selected Customize  txnelson_4-1749266419979.png

     

  7. I then selected the Marker 0 and using the down arrow, moved the black marker down past the Line(0)txnelson_5-1749266609159.png

     

  8. Which produced the final graph      txnelson_6-1749266675688.png

     

Here is the JSL that will generate the graph

Graph Builder(
	Show Control Panel( 0 ),
	Variables(
		X( :Ex ),
		Y( :Gxy ),
		Overlay( :overlay_column ),
		Color( :overlay_column )
	),
	Elements(
		Points( X, Y, Legend( 5 ) ),
		Line( X, Y, Legend( 6 ), Row order( 1 ) )
	),
	SendToReport(
		Dispatch( {}, "400", ScaleBox,
			{Legend Model(
				5,
				Properties(
					0,
					{Line Color( 0 ), Marker( "FilledCircle" )},
					Item ID( "0", 1 )
				),
				Properties( 1, {Marker( "Circle" )}, Item ID( "1", 1 ) )
			), Legend Model(
				6,
				Properties( 0, {Line Color( 2 )}, Item ID( "0", 1 ) )
			)}
		),
		Dispatch( {}, "Graph Builder", FrameBox, {Reorder Segs( {1, 2, 5, 6} )} )
	)
);

There are other ways to handle this.  Here is a straight forward JSL method that uses Add Graphic Script to draw the line

txnelson_7-1749267614743.png

Graph Builder(
	Size( 534, 456 ),
	Show Control Panel( 0 ),
	Variables( X( :Ex ), Y( :Gxy ) ),
	Elements( Points( X, Y, Legend( 3 ) ) ),
	SendToReport(
		Dispatch( {}, "Gxy", ScaleBox,
			{Min( 0.781114518510881 ), Max( 3.84890945699133 ), Inc( 0.5 ),
			Minor Ticks( 0 )}
		),
		Dispatch( {}, "Graph Builder", FrameBox,
			{Add Graphics Script(
				2,
				Description( "" ),
				Pen Color( "Red" );
				Line( {5, 1}, {5.5, 3.5}, {10, 3}, {11, 1.5}, {5, 1} );
			)}
		)
	)
);

No overlay column and rows are required

 

Jim

View solution in original post

shampton82
Level VII

Re: Graph Builder: connect a subset of points with line segments and show only markers for the other points

Hey @VladimirB ,

I could get something along the lines you want but this approach is really clunky as you really have to order the rows to make sure that the points link the way you want.  So at this point it is not that you would just select the points and they would make a nice closed shape.  But, since your data is correctly ordered in your example this does do what you want.

 

shampton82_0-1749267661661.png

 

I created two new columns (col 4 and col 5) that only returned the values of the selected rows and then added a dummy row at the end that allowed col 4 and col 5 to return the lowest value selected, thus closing the shape.

 

shampton82_1-1749267807693.png

shampton82_2-1749267869092.png

I added column 4 as a second Y axis and column 5 as a second x axis and had the point element only respect Gxy and Ex and had the line element only respect Col4 and Col 5 in row order.  

 

So like a said a bit clunky but it gets you there and might inspire you or another user to make something even better!

 

Steve

 

 

View solution in original post

shampton82
Level VII

Re: Graph Builder: connect a subset of points with line segments and show only markers for the other points

Hey @VladimirB ,

So i wanted to make something interactive to create connected points like you were asking about so I came up with this script to be able to interactively link points.  So attached is a script that you can use to select points and have them become connected by line segments. 

 

When you run it, it will ask you what columns to use as the Y and x axis columns

shampton82_0-1749353536826.png

 

When you press okay it will create three columns and then a new window will pop up:

shampton82_1-1749353578327.png

At this point you can run the table script

shampton82_2-1749353605032.png

which gives you this 

shampton82_3-1749353622566.png

 

Now you can select a point then click "set value" in the user interface window

shampton82_4-1749353667350.png

 

 

you can then select a new point and press the "set value" button again to connect the two points

shampton82_5-1749353704483.png

 

do this until all your points are selected

shampton82_6-1749353747275.png

 

Once you have selected all the points click the "Finished" button to link the line to the starting point

shampton82_7-1749353793176.png

 

If you missed a point you can select it and press "Set Value" which will make it look messed up for a second

shampton82_8-1749353832319.png

but you can use the "Insert midway point" button to fix it.  In this case point 8 should really be after point 5 so when you click the button you will put in 5 and press okay.

shampton82_9-1749353905345.png

 

and Bam! the points are reordered

shampton82_10-1749353923883.png

 

If you need to start over press the "Clear Values" button

 

Hope this helps!  Also, I'm sure this is not robust to many different usages so high probability outside of the way I just showed the workflow to be it will have a bug.

 

Hey @hogi,

I'm sure you could make this be way more useful than I did.

 

Steve

 

 

View solution in original post

5 REPLIES 5
txnelson
Super User

Re: Graph Builder: connect a subset of points with line segments and show only markers for the other points

txnelson_0-1749265454891.png

I produced this interactively

  1. I added an additional Overlay Row to the data table to add the connecting line to finish where it startedtxnelson_1-1749265723839.png

     

  2. I then dragged the Overlay_column to the color drop box
  3. I then added a Line to the graph which displayed 2 lines                      txnelson_2-1749265977611.png

     

  4. I didn't want the black line so I simply set the line color for the black line to whitetxnelson_3-1749266123754.png

     

  5. That left the markers for the points for the non overlay data looking funny.  This is because the former black line is displayed on top of the points.
  6. To move the black points to be displayed on top of the now white (invisible to the user_ lines, I right clicked on the graph and selected Customize  txnelson_4-1749266419979.png

     

  7. I then selected the Marker 0 and using the down arrow, moved the black marker down past the Line(0)txnelson_5-1749266609159.png

     

  8. Which produced the final graph      txnelson_6-1749266675688.png

     

Here is the JSL that will generate the graph

Graph Builder(
	Show Control Panel( 0 ),
	Variables(
		X( :Ex ),
		Y( :Gxy ),
		Overlay( :overlay_column ),
		Color( :overlay_column )
	),
	Elements(
		Points( X, Y, Legend( 5 ) ),
		Line( X, Y, Legend( 6 ), Row order( 1 ) )
	),
	SendToReport(
		Dispatch( {}, "400", ScaleBox,
			{Legend Model(
				5,
				Properties(
					0,
					{Line Color( 0 ), Marker( "FilledCircle" )},
					Item ID( "0", 1 )
				),
				Properties( 1, {Marker( "Circle" )}, Item ID( "1", 1 ) )
			), Legend Model(
				6,
				Properties( 0, {Line Color( 2 )}, Item ID( "0", 1 ) )
			)}
		),
		Dispatch( {}, "Graph Builder", FrameBox, {Reorder Segs( {1, 2, 5, 6} )} )
	)
);

There are other ways to handle this.  Here is a straight forward JSL method that uses Add Graphic Script to draw the line

txnelson_7-1749267614743.png

Graph Builder(
	Size( 534, 456 ),
	Show Control Panel( 0 ),
	Variables( X( :Ex ), Y( :Gxy ) ),
	Elements( Points( X, Y, Legend( 3 ) ) ),
	SendToReport(
		Dispatch( {}, "Gxy", ScaleBox,
			{Min( 0.781114518510881 ), Max( 3.84890945699133 ), Inc( 0.5 ),
			Minor Ticks( 0 )}
		),
		Dispatch( {}, "Graph Builder", FrameBox,
			{Add Graphics Script(
				2,
				Description( "" ),
				Pen Color( "Red" );
				Line( {5, 1}, {5.5, 3.5}, {10, 3}, {11, 1.5}, {5, 1} );
			)}
		)
	)
);

No overlay column and rows are required

 

Jim
VladimirB
Level II

Re: Graph Builder: connect a subset of points with line segments and show only markers for the other points

Thank you so much, TXNELSON!

You provided a very nice solution!  With the great script!  I will definitely try it!

I appreciate very much your fast and detailed response with all the guidelines!

 

~ Vladimir

shampton82
Level VII

Re: Graph Builder: connect a subset of points with line segments and show only markers for the other points

Hey @VladimirB ,

I could get something along the lines you want but this approach is really clunky as you really have to order the rows to make sure that the points link the way you want.  So at this point it is not that you would just select the points and they would make a nice closed shape.  But, since your data is correctly ordered in your example this does do what you want.

 

shampton82_0-1749267661661.png

 

I created two new columns (col 4 and col 5) that only returned the values of the selected rows and then added a dummy row at the end that allowed col 4 and col 5 to return the lowest value selected, thus closing the shape.

 

shampton82_1-1749267807693.png

shampton82_2-1749267869092.png

I added column 4 as a second Y axis and column 5 as a second x axis and had the point element only respect Gxy and Ex and had the line element only respect Col4 and Col 5 in row order.  

 

So like a said a bit clunky but it gets you there and might inspire you or another user to make something even better!

 

Steve

 

 

VladimirB
Level II

Re: Graph Builder: connect a subset of points with line segments and show only markers for the other points

Thank you very much, SHAMPTON82!

You provided a very nice solution!  I will try it out

I appreciate very much your fast and detailed response with all the guidelines!

And you made an interactive solution too! 

This is very educational for me!

 

Thank you!

 

~ Vladimir

shampton82
Level VII

Re: Graph Builder: connect a subset of points with line segments and show only markers for the other points

Hey @VladimirB ,

So i wanted to make something interactive to create connected points like you were asking about so I came up with this script to be able to interactively link points.  So attached is a script that you can use to select points and have them become connected by line segments. 

 

When you run it, it will ask you what columns to use as the Y and x axis columns

shampton82_0-1749353536826.png

 

When you press okay it will create three columns and then a new window will pop up:

shampton82_1-1749353578327.png

At this point you can run the table script

shampton82_2-1749353605032.png

which gives you this 

shampton82_3-1749353622566.png

 

Now you can select a point then click "set value" in the user interface window

shampton82_4-1749353667350.png

 

 

you can then select a new point and press the "set value" button again to connect the two points

shampton82_5-1749353704483.png

 

do this until all your points are selected

shampton82_6-1749353747275.png

 

Once you have selected all the points click the "Finished" button to link the line to the starting point

shampton82_7-1749353793176.png

 

If you missed a point you can select it and press "Set Value" which will make it look messed up for a second

shampton82_8-1749353832319.png

but you can use the "Insert midway point" button to fix it.  In this case point 8 should really be after point 5 so when you click the button you will put in 5 and press okay.

shampton82_9-1749353905345.png

 

and Bam! the points are reordered

shampton82_10-1749353923883.png

 

If you need to start over press the "Clear Values" button

 

Hope this helps!  Also, I'm sure this is not robust to many different usages so high probability outside of the way I just showed the workflow to be it will have a bug.

 

Hey @hogi,

I'm sure you could make this be way more useful than I did.

 

Steve

 

 

Recommended Articles