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

How can i plot multiple reference lines with different values ?

Hi 

With graph builder I'm trying to put multiple reference lines with different values on a same plot but divided in to different groups. I'm displaying different plots on these groups and want to set limits with different reference lines. 
I'm able to put ref lines on both X and Y axis but getting same line on all group of plots. 
Need help here

Graph Builder(
	Size( 865, 686 ),
	Variables(
		X( :total_attenuation_db ),
		Y(
			Transform Column(
				"Transform[rate_kbits_sec]",
				Continuous,
				Formula( Num( :rate_kbits_sec ) )
			)
		),
		Group X( :iperf_protocol ),
		Group Y( :bw_mhz ),
		Overlay( :run_tag )
	),
	Elements(
		Line( X, Y, Legend( 6 ) ),
		Points( X, Y, Legend( 7 ) ),
		Caption Box( X, Y, Legend( 8 ), Summary Statistic( "Max" ) )
	),
	SendToReport(
		Dispatch(
			{},
			"total_attenuation_db",
			ScaleBox,
			{Add Ref Line( 94, "Dashed", "Medium Dark Red", "Limit", 2 )}
		),
		Dispatch(
			{},
			"Transform[rate_kbits_sec]",
			ScaleBox,
			{Min( 0 ), Max( 22821.89167292 ), Inc( 1000 ), Minor Ticks( 1 ),
			Add Ref Line( 10000, "Dashed", "Medium Dark Red", "Min Limit ", 2 )}
		)
	)
);

Thanks 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: How can i plot multiple reference lines with different values ?

Any form of grouping within Graph Builder will result in reference line being shared between groups.  That is, if there is X grouping, reference lines on the Y axis will flow across all X groups.

The only way that I know of to avoid this, is to generate separate Graph Builder instances, and then have JMP group the resulting instances of Graph Builder.  You can accomplish this by subsetting the data table into the rows you need for each graph.  Then run Graph Builder on each of the subsets, and place them into a New Window() for the display.  You can also use Where Clause processing within a Single Graph Builder instance, and get similar results.  Below is an example of that using the Big Class data table.

txnelson_0-1634136015967.png

 

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/big class.jmp" );
New Window( "graphs",
	Lineup Box( N Col( 6 ), 

		Graph Builder(
			SendToByGroup( {:sex == "F", :age == 12} ),
			Size( 289, 238 ),
			Show Control Panel( 0 ),
			Variables( X( :weight ), Y( :height ) ),
			Elements( Points( X, Y, Legend( 1 ) ) ),
			By(  :sex,:age ),
			SendToByGroup(
				{:sex == "F", :age == 12},
				SendToReport(
					Dispatch(
						{"Graph Builder sex=F, age=12"},
						"weight",
						ScaleBox,
						{Add Ref Line( 105, "Solid", "Black", "", 1 )}
					),
					Dispatch(
						{"Graph Builder sex=F, age=12"},
						"height",
						ScaleBox,
						{Add Ref Line( 59, "Solid", "Black", "", 1 )}
					)
				)
			),
			SendToByGroup(
				{:sex == "F", :age == 13},
				SendToReport(
					Dispatch(
						{"Graph Builder sex=F, age=13"},
						"weight",
						ScaleBox,
						{Add Ref Line( 90, "Solid", "Black", "", 1 )}
					),
					Dispatch(
						{"Graph Builder sex=F, age=13"},
						"height",
						ScaleBox,
						{Add Ref Line( 55, "Solid", "Black", "", 1 )}
					)
				)
			),
			SendToByGroup(
				{:sex == "F", :age == 14},
				SendToReport(
					Dispatch(
						{"Graph Builder sex=F, age=14"},
						"weight",
						ScaleBox,
						{Add Ref Line( 111.5, "Solid", "Black", "", 1 )}
					),
					Dispatch(
						{"Graph Builder sex=F, age=14"},
						"height",
						ScaleBox,
						{Add Ref Line( 63, "Solid", "Black", "", 1 )}
					)
				)
			),
			SendToByGroup(
				{:sex == "F", :age == 15},
				SendToReport(
					Dispatch(
						{"Graph Builder sex=F, age=15"},
						"weight",
						ScaleBox,
						{Add Ref Line( 102, "Solid", "Black", "", 1 )}
					),
					Dispatch(
						{"Graph Builder sex=F, age=15"},
						"height",
						ScaleBox,
						{Min( 55.0888655110677 ), Max( 64.901549594752 ), Inc( 2 ),
						Minor Ticks( 1 ), Add Ref Line( 57, "Solid", "Black", "", 1 )}
					)
				)
			),
			SendToByGroup(
				{:sex == "F", :age == 16},
				SendToReport(
					Dispatch(
						{"Graph Builder sex=F, age=16"},
						"weight",
						ScaleBox,
						{Add Ref Line( 113.5, "Solid", "Black", "", 1 )}
					),
					Dispatch(
						{"Graph Builder sex=F, age=16"},
						"height",
						ScaleBox,
						{Add Ref Line( 62.5, "Solid", "Black", "", 1 )}
					)
				)
			),
			SendToByGroup(
				{:sex == "F", :age == 17},
				SendToReport(
					Dispatch(
						{"Graph Builder sex=F, age=17"},
						"weight",
						ScaleBox,
						{Add Ref Line( 116, "Solid", "Black", "", 1 )}
					),
					Dispatch(
						{"Graph Builder sex=F, age=17"},
						"height",
						ScaleBox,
						{Add Ref Line( 62, "Solid", "Black", "", 1 )}
					)
				)
			),
			SendToByGroup(
				{:sex == "M", :age == 12},
				SendToReport(
					Dispatch(
						{"Graph Builder sex=M, age=12"},
						"weight",
						ScaleBox,
						{Add Ref Line( 103.52, "Solid", "Black", "", 1 )}
					),
					Dispatch(
						{"Graph Builder sex=M, age=12"},
						"height",
						ScaleBox,
						{Add Ref Line( 56, "Solid", "Black", "", 1 )}
					)
				)
			),
			SendToByGroup(
				{:sex == "M", :age == 13},
				SendToReport(
					Dispatch(
						{"Graph Builder sex=M, age=13"},
						"weight",
						ScaleBox,
						{Add Ref Line( 92, "Solid", "Black", "", 1 )}
					),
					Dispatch(
						{"Graph Builder sex=M, age=13"},
						"height",
						ScaleBox,
						{Add Ref Line( 61.5, "Solid", "Black", "", 1 )}
					)
				)
			),
			SendToByGroup(
				{:sex == "M", :age == 14},
				SendToReport(
					Dispatch(
						{"Graph Builder sex=M, age=14"},
						"weight",
						ScaleBox,
						{Add Ref Line( 105.04, "Solid", "Black", "", 1 )}
					),
					Dispatch(
						{"Graph Builder sex=M, age=14"},
						"height",
						ScaleBox,
						{Add Ref Line( 66, "Solid", "Black", "", 1 )}
					)
				)
			),
			SendToByGroup(
				{:sex == "M", :age == 15},
				SendToReport(
					Dispatch(
						{"Graph Builder sex=M, age=15"},
						"weight",
						ScaleBox,
						{Add Ref Line( 116.52, "Solid", "Black", "", 1 )}
					),
					Dispatch(
						{"Graph Builder sex=M, age=15"},
						"height",
						ScaleBox,
						{Add Ref Line( 64.5, "Solid", "Black", "", 1 )}
					)
				)
			),
			SendToByGroup(
				{:sex == "M", :age == 16},
				SendToReport(
					Dispatch(
						{"Graph Builder sex=M, age=16"},
						"weight",
						ScaleBox,
						{Add Ref Line( 128, "Solid", "Black", "", 1 )}
					),
					Dispatch(
						{"Graph Builder sex=M, age=16"},
						"height",
						ScaleBox,
						{Add Ref Line( 68, "Solid", "Black", "", 1 )}
					)
				)
			),
			SendToByGroup(
				{:sex == "M", :age == 17},
				SendToReport(
					Dispatch(
						{"Graph Builder sex=M, age=17"},
						"weight",
						ScaleBox,
						{Add Ref Line( 153.74, "Solid", "Black", "", 1 )}
					),
					Dispatch(
						{"Graph Builder sex=M, age=17"},
						"height",
						ScaleBox,
						{Add Ref Line( 69, "Solid", "Black", "", 1 )}
					)
				)
			)
		)
	)
);
Jim

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: How can i plot multiple reference lines with different values ?

Any form of grouping within Graph Builder will result in reference line being shared between groups.  That is, if there is X grouping, reference lines on the Y axis will flow across all X groups.

The only way that I know of to avoid this, is to generate separate Graph Builder instances, and then have JMP group the resulting instances of Graph Builder.  You can accomplish this by subsetting the data table into the rows you need for each graph.  Then run Graph Builder on each of the subsets, and place them into a New Window() for the display.  You can also use Where Clause processing within a Single Graph Builder instance, and get similar results.  Below is an example of that using the Big Class data table.

txnelson_0-1634136015967.png

 

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/big class.jmp" );
New Window( "graphs",
	Lineup Box( N Col( 6 ), 

		Graph Builder(
			SendToByGroup( {:sex == "F", :age == 12} ),
			Size( 289, 238 ),
			Show Control Panel( 0 ),
			Variables( X( :weight ), Y( :height ) ),
			Elements( Points( X, Y, Legend( 1 ) ) ),
			By(  :sex,:age ),
			SendToByGroup(
				{:sex == "F", :age == 12},
				SendToReport(
					Dispatch(
						{"Graph Builder sex=F, age=12"},
						"weight",
						ScaleBox,
						{Add Ref Line( 105, "Solid", "Black", "", 1 )}
					),
					Dispatch(
						{"Graph Builder sex=F, age=12"},
						"height",
						ScaleBox,
						{Add Ref Line( 59, "Solid", "Black", "", 1 )}
					)
				)
			),
			SendToByGroup(
				{:sex == "F", :age == 13},
				SendToReport(
					Dispatch(
						{"Graph Builder sex=F, age=13"},
						"weight",
						ScaleBox,
						{Add Ref Line( 90, "Solid", "Black", "", 1 )}
					),
					Dispatch(
						{"Graph Builder sex=F, age=13"},
						"height",
						ScaleBox,
						{Add Ref Line( 55, "Solid", "Black", "", 1 )}
					)
				)
			),
			SendToByGroup(
				{:sex == "F", :age == 14},
				SendToReport(
					Dispatch(
						{"Graph Builder sex=F, age=14"},
						"weight",
						ScaleBox,
						{Add Ref Line( 111.5, "Solid", "Black", "", 1 )}
					),
					Dispatch(
						{"Graph Builder sex=F, age=14"},
						"height",
						ScaleBox,
						{Add Ref Line( 63, "Solid", "Black", "", 1 )}
					)
				)
			),
			SendToByGroup(
				{:sex == "F", :age == 15},
				SendToReport(
					Dispatch(
						{"Graph Builder sex=F, age=15"},
						"weight",
						ScaleBox,
						{Add Ref Line( 102, "Solid", "Black", "", 1 )}
					),
					Dispatch(
						{"Graph Builder sex=F, age=15"},
						"height",
						ScaleBox,
						{Min( 55.0888655110677 ), Max( 64.901549594752 ), Inc( 2 ),
						Minor Ticks( 1 ), Add Ref Line( 57, "Solid", "Black", "", 1 )}
					)
				)
			),
			SendToByGroup(
				{:sex == "F", :age == 16},
				SendToReport(
					Dispatch(
						{"Graph Builder sex=F, age=16"},
						"weight",
						ScaleBox,
						{Add Ref Line( 113.5, "Solid", "Black", "", 1 )}
					),
					Dispatch(
						{"Graph Builder sex=F, age=16"},
						"height",
						ScaleBox,
						{Add Ref Line( 62.5, "Solid", "Black", "", 1 )}
					)
				)
			),
			SendToByGroup(
				{:sex == "F", :age == 17},
				SendToReport(
					Dispatch(
						{"Graph Builder sex=F, age=17"},
						"weight",
						ScaleBox,
						{Add Ref Line( 116, "Solid", "Black", "", 1 )}
					),
					Dispatch(
						{"Graph Builder sex=F, age=17"},
						"height",
						ScaleBox,
						{Add Ref Line( 62, "Solid", "Black", "", 1 )}
					)
				)
			),
			SendToByGroup(
				{:sex == "M", :age == 12},
				SendToReport(
					Dispatch(
						{"Graph Builder sex=M, age=12"},
						"weight",
						ScaleBox,
						{Add Ref Line( 103.52, "Solid", "Black", "", 1 )}
					),
					Dispatch(
						{"Graph Builder sex=M, age=12"},
						"height",
						ScaleBox,
						{Add Ref Line( 56, "Solid", "Black", "", 1 )}
					)
				)
			),
			SendToByGroup(
				{:sex == "M", :age == 13},
				SendToReport(
					Dispatch(
						{"Graph Builder sex=M, age=13"},
						"weight",
						ScaleBox,
						{Add Ref Line( 92, "Solid", "Black", "", 1 )}
					),
					Dispatch(
						{"Graph Builder sex=M, age=13"},
						"height",
						ScaleBox,
						{Add Ref Line( 61.5, "Solid", "Black", "", 1 )}
					)
				)
			),
			SendToByGroup(
				{:sex == "M", :age == 14},
				SendToReport(
					Dispatch(
						{"Graph Builder sex=M, age=14"},
						"weight",
						ScaleBox,
						{Add Ref Line( 105.04, "Solid", "Black", "", 1 )}
					),
					Dispatch(
						{"Graph Builder sex=M, age=14"},
						"height",
						ScaleBox,
						{Add Ref Line( 66, "Solid", "Black", "", 1 )}
					)
				)
			),
			SendToByGroup(
				{:sex == "M", :age == 15},
				SendToReport(
					Dispatch(
						{"Graph Builder sex=M, age=15"},
						"weight",
						ScaleBox,
						{Add Ref Line( 116.52, "Solid", "Black", "", 1 )}
					),
					Dispatch(
						{"Graph Builder sex=M, age=15"},
						"height",
						ScaleBox,
						{Add Ref Line( 64.5, "Solid", "Black", "", 1 )}
					)
				)
			),
			SendToByGroup(
				{:sex == "M", :age == 16},
				SendToReport(
					Dispatch(
						{"Graph Builder sex=M, age=16"},
						"weight",
						ScaleBox,
						{Add Ref Line( 128, "Solid", "Black", "", 1 )}
					),
					Dispatch(
						{"Graph Builder sex=M, age=16"},
						"height",
						ScaleBox,
						{Add Ref Line( 68, "Solid", "Black", "", 1 )}
					)
				)
			),
			SendToByGroup(
				{:sex == "M", :age == 17},
				SendToReport(
					Dispatch(
						{"Graph Builder sex=M, age=17"},
						"weight",
						ScaleBox,
						{Add Ref Line( 153.74, "Solid", "Black", "", 1 )}
					),
					Dispatch(
						{"Graph Builder sex=M, age=17"},
						"height",
						ScaleBox,
						{Add Ref Line( 69, "Solid", "Black", "", 1 )}
					)
				)
			)
		)
	)
);
Jim
mati
Level I

Re: How can i plot multiple reference lines with different values ?

Thanks, i'll give it a try