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

Draw paired data

How I draw paired data like that in JMP? Hope the help from our community.

Screenshot_2024-06-02-12-52-32-250_com.android.chrome.jpg

 

1 ACCEPTED SOLUTION

Accepted Solutions
Victor_G
Super User

Re: Draw paired data

Hi @thiennguyen,

 

This graph is quite easy if you have a datatable containing the columns ID (GS, JM, HM, JW, ...), treatment phase and the response in stacked format :

Victor_G_0-1717329880698.png

Using the graph builder, you can then set "treatment phase" as X, response as Y axis, and ID as "overlay" variable.
You can then Shift + Left click on "Line" to add connecting lines betwwen the data points.
You can then hide the points marker in the legend, change the colors, set "Value Order" column properties to order your ID and the treatment phase (because else it will be ordered by default in alphabetic order), and specify the jitter of the points as "None" so that the line do connect the points exactly.

 

At then end, you can obtain this graph :

Victor_G_1-1717330069429.png

And here is the script for this graph :


Graph Builder(
	Size( 534, 450 ),
	Show Control Panel( 0 ),
	Variables( X( :Treatment phase ), Y( :Response ), Overlay( :ID ) ),
	Elements(
		Points( X, Y, Legend( 6 ), Jitter( "None" ) ),
		Line(
			X,
			Y,
			Legend( 8 ),
			Error Interval( "None" ),
			Missing Values( "No Connection" )
		)
	),
	SendToReport(
		Dispatch(
			{},
			"Response",
			ScaleBox,
			{Min( 0 ), Max( 101 ), Inc( 20 ), Minor Ticks( 1 )}
		),
		Dispatch(
			{},
			"400",
			ScaleBox,
			{Legend Model(
				6,
				Base( 0, 0, 0, Item ID( "GS", 1 ) ),
				Base( 1, 0, 0, Item ID( "JM", 1 ) ),
				Base( 2, 0, 0, Item ID( "HM", 1 ) ),
				Base( 3, 0, 0, Item ID( "JW", 1 ) ),
				Base( 4, 0, 0, Item ID( "PS", 1 ) ),
				Base( 5, 0, 0, Item ID( "GV", 1 ) ),
				Properties(
					0,
					{Line Color( 19 ), Marker Size( 6 )},
					Item ID( "GS", 1 )
				),
				Properties(
					1,
					{Line Color( 21 ), Marker Size( 6 )},
					Item ID( "JM", 1 )
				),
				Properties(
					2,
					{Line Color( 75 ), Marker Size( 6 )},
					Item ID( "HM", 1 )
				),
				Properties(
					3,
					{Line Color( 20 ), Marker Size( 6 )},
					Item ID( "JW", 1 )
				),
				Properties(
					4,
					{Line Color( 25 ), Marker Size( 6 )},
					Item ID( "PS", 1 )
				),
				Properties(
					5,
					{Line Color( 27 ), Marker Size( 6 )},
					Item ID( "GV", 1 )
				),
				Properties( -1, {Marker Size( 6 )}, Item ID( "Response", 1 ) )
			), Legend Model(
				8,
				Properties( 0, {Line Color( 19 )}, Item ID( "GS", 1 ) ),
				Properties( 1, {Line Color( 21 )}, Item ID( "JM", 1 ) ),
				Properties( 2, {Line Color( 75 )}, Item ID( "HM", 1 ) ),
				Properties( 3, {Line Color( 20 )}, Item ID( "JW", 1 ) ),
				Properties( 4, {Line Color( 9 )}, Item ID( "PS", 1 ) ),
				Properties( 5, {Line Color( 27 )}, Item ID( "GV", 1 ) )
			)}
		),
		Dispatch(
			{},
			"400",
			LegendBox,
			{Legend Position( {6, [-1, -1, -1, -1, -1, -1], 8, [0, 1, 2, 3, 4, 5]} )
			}
		)
	)
);

I add the datatable as an example with the graph script so that you can see how the table is setup with column properties, and how the graph has been created.

 

Hope this answer will help you,

Victor GUILLER
Scientific Expertise Engineer
L'Oréal - Data & Analytics

View solution in original post

2 REPLIES 2
Thierry_S
Super User

Re: Draw paired data

Hi,

First, your data should be arranged in a stacked (i.e., tall) format, with a column for time points (Before and After), a column for individual identifiers, and a column for the values you want to plot.

 

Go to Graph Builder, assign the Y axis to your data values, the X axis to the time points, and the Overlay to individual identifiers.

Choose Points and Lines (Upper menu) to show each data point connected across the time points.

Of note, to align the Dots with the Line, go to the Points customization menu (lower left) and select Jitter > None.

 

From here, you can experiment with different formatting options.

 

Best,

TS

Thierry R. Sornasse
Victor_G
Super User

Re: Draw paired data

Hi @thiennguyen,

 

This graph is quite easy if you have a datatable containing the columns ID (GS, JM, HM, JW, ...), treatment phase and the response in stacked format :

Victor_G_0-1717329880698.png

Using the graph builder, you can then set "treatment phase" as X, response as Y axis, and ID as "overlay" variable.
You can then Shift + Left click on "Line" to add connecting lines betwwen the data points.
You can then hide the points marker in the legend, change the colors, set "Value Order" column properties to order your ID and the treatment phase (because else it will be ordered by default in alphabetic order), and specify the jitter of the points as "None" so that the line do connect the points exactly.

 

At then end, you can obtain this graph :

Victor_G_1-1717330069429.png

And here is the script for this graph :


Graph Builder(
	Size( 534, 450 ),
	Show Control Panel( 0 ),
	Variables( X( :Treatment phase ), Y( :Response ), Overlay( :ID ) ),
	Elements(
		Points( X, Y, Legend( 6 ), Jitter( "None" ) ),
		Line(
			X,
			Y,
			Legend( 8 ),
			Error Interval( "None" ),
			Missing Values( "No Connection" )
		)
	),
	SendToReport(
		Dispatch(
			{},
			"Response",
			ScaleBox,
			{Min( 0 ), Max( 101 ), Inc( 20 ), Minor Ticks( 1 )}
		),
		Dispatch(
			{},
			"400",
			ScaleBox,
			{Legend Model(
				6,
				Base( 0, 0, 0, Item ID( "GS", 1 ) ),
				Base( 1, 0, 0, Item ID( "JM", 1 ) ),
				Base( 2, 0, 0, Item ID( "HM", 1 ) ),
				Base( 3, 0, 0, Item ID( "JW", 1 ) ),
				Base( 4, 0, 0, Item ID( "PS", 1 ) ),
				Base( 5, 0, 0, Item ID( "GV", 1 ) ),
				Properties(
					0,
					{Line Color( 19 ), Marker Size( 6 )},
					Item ID( "GS", 1 )
				),
				Properties(
					1,
					{Line Color( 21 ), Marker Size( 6 )},
					Item ID( "JM", 1 )
				),
				Properties(
					2,
					{Line Color( 75 ), Marker Size( 6 )},
					Item ID( "HM", 1 )
				),
				Properties(
					3,
					{Line Color( 20 ), Marker Size( 6 )},
					Item ID( "JW", 1 )
				),
				Properties(
					4,
					{Line Color( 25 ), Marker Size( 6 )},
					Item ID( "PS", 1 )
				),
				Properties(
					5,
					{Line Color( 27 ), Marker Size( 6 )},
					Item ID( "GV", 1 )
				),
				Properties( -1, {Marker Size( 6 )}, Item ID( "Response", 1 ) )
			), Legend Model(
				8,
				Properties( 0, {Line Color( 19 )}, Item ID( "GS", 1 ) ),
				Properties( 1, {Line Color( 21 )}, Item ID( "JM", 1 ) ),
				Properties( 2, {Line Color( 75 )}, Item ID( "HM", 1 ) ),
				Properties( 3, {Line Color( 20 )}, Item ID( "JW", 1 ) ),
				Properties( 4, {Line Color( 9 )}, Item ID( "PS", 1 ) ),
				Properties( 5, {Line Color( 27 )}, Item ID( "GV", 1 ) )
			)}
		),
		Dispatch(
			{},
			"400",
			LegendBox,
			{Legend Position( {6, [-1, -1, -1, -1, -1, -1], 8, [0, 1, 2, 3, 4, 5]} )
			}
		)
	)
);

I add the datatable as an example with the graph script so that you can see how the table is setup with column properties, and how the graph has been created.

 

Hope this answer will help you,

Victor GUILLER
Scientific Expertise Engineer
L'Oréal - Data & Analytics