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

How do I combine multiple plots type into a single graph

Hello everyone,

I just want to add "by hands" control limits to a variable, but the issue is that the limits are not constant and vary according to the sample studied.

Do you know if it is possible to put on the same graph points (from the variable) and lines (from the control limits)? 

Thank you in advance,

Regards

 

5 REPLIES 5

Re: How do I combine multiple plots type into a single graph

You can add custom lines to most graphs in JMP by right clicking the axis and selecting Axis Settings, then manually adding a line in the Reference Lines section.

If you're looking to do this programmatically (you mention that the lines you want to add are variable), this can be done as well. Screenshot and script below.

 

Jed_Campbell_0-1671033012313.png

dt = open ("$SAMPLE_DATA\Big Class.jmp");

var = 145;

Graph Builder(
	Transform Column( "Row", Formula( Row() ) ),
	Size( 794, 355 ),
	Show Control Panel( 0 ),
	Variables( X( :Row ), Y( :weight ) ),
	Elements( Points( X, Y, Legend( 4 ), Jitter Limit( 0.9541 ) ) ),
	SendToReport(
		Dispatch(
			{},
			"weight",
			ScaleBox,
			{Add Ref Line( var, "Solid", "Red", "Custom Limit", 1 )}
		)
	)
);

 

Re: How do I combine multiple plots type into a single graph

Hello, and thank you for your answer.

I knew that the solution right click and add lines would work, but the fact that the limits were variable made it impossible to use.

In fact, the limits were calculated and added to the database in order to be associated with the right sample, that's why I m searching for a way to add lines and points to the same graph

 

ih
Super User (Alumni) ih
Super User (Alumni)

Re: How do I combine multiple plots type into a single graph

Try building the chart with points first and then right click in the graph area and select Add > Line.

pmroz
Super User

Re: How do I combine multiple plots type into a single graph

To add variable lines to a graph try something like this:

dt = open("$Sample_data\Big Class.jmp");

upper_limit = 65;
lower_limit = 55;

gb = dt << Graph Builder(
	Size( 525, 454 ),
	Show Control Panel( 0 ),
	Variables( X( :weight ), Y( :height ) ),
	Elements( Points( X, Y, Legend( 9 ) ) ),
	SendToReport(
		Dispatch(
			{},
			"height",
			ScaleBox,
			{Add Ref Line( upper_limit, "Solid", "Dark Red", "Upper Limit", 2 ),
			Add Ref Line( lower_limit, "Solid", "Dark Blue", "Lower Limit", 2 )}
		)
	)
);

pmroz_0-1671115411753.png

The way I did this was by:

  • Creating the graph
  • Adding the upper and lower limit lines using constant values.
  • Right-clicked the red triangle and saved the script.
  • I replaced the constant values with variables.

 

pmroz
Super User

Re: How do I combine multiple plots type into a single graph

If you want to add the lines separately here's how to do it:

gb2 = dt << Graph Builder(
	Size( 525, 454 ),
	Show Control Panel( 0 ),
	Variables( X( :weight ), Y( :height ) ),
	Elements( Points( X, Y, Legend( 9 ) ) ),
);

gb2 << sendtoreport(
			Dispatch( {}, "height", ScaleBox,
			{Add Ref Line( upper_limit, "Solid", "Dark Red", "Upper Limit", 2 ),
			Add Ref Line( lower_limit, "Solid", "Dark Blue", "Lower Limit", 2 )}
		)
	);