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

Possible to overlay text on a plot?

Hi.  Does anyone know if there is a scripting method to add text on top of a plot?  For example, I have a script to create a pareto plot and I'd like to add text over the plot, as shown in the attached file.  Note I don't mean adding a title above the plot.  I mean to ask if there is a way to actually place the text within the plot area.  I feel there is a way, but so far my search has been unsuccessful.  Thanks!

 

Using JMP Pro 17.2.0.

 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Possible to overlay text on a plot?

Build the graph as you want it to be.  Then using the annotation tool icons select the text icon txnelson_0-1695865378495.png

and add in the text you want on the place on the graph where you want it.  Right clicking on the  annotation will allow you to set the font and color etc.

txnelson_1-1695865505332.png

Then go to the red triangle and select to save the script to a script window, and you will get a script that will create the graph and the annotation.


Graph Builder(
	Size( 522, 486 ),
	Show Control Panel( 0 ),
	Variables(
		X( :age, Order By( :age, Descending, Order Statistic( "N" ) ) ),
		Group X( :sex )
	),
	Elements( Bar( X, Legend( 8 ) ) ),
	SendToReport(
		Dispatch(
			{},
			"Graph Builder",
			FrameBox,
			Add Text Annotation(
				Text( "Overlay Text Here" ),
				Fixed Size( 0 ),
				Text Box( {46, 31, 224, 68} ),
				Text Color( "Medium Dark Red" ),
				Font( "Segoe UI", 14, "Bold" ),
				Filled( 0 )
			)
		)
	)
);

 

Jim

View solution in original post

3 REPLIES 3
txnelson
Super User

Re: Possible to overlay text on a plot?

Build the graph as you want it to be.  Then using the annotation tool icons select the text icon txnelson_0-1695865378495.png

and add in the text you want on the place on the graph where you want it.  Right clicking on the  annotation will allow you to set the font and color etc.

txnelson_1-1695865505332.png

Then go to the red triangle and select to save the script to a script window, and you will get a script that will create the graph and the annotation.


Graph Builder(
	Size( 522, 486 ),
	Show Control Panel( 0 ),
	Variables(
		X( :age, Order By( :age, Descending, Order Statistic( "N" ) ) ),
		Group X( :sex )
	),
	Elements( Bar( X, Legend( 8 ) ) ),
	SendToReport(
		Dispatch(
			{},
			"Graph Builder",
			FrameBox,
			Add Text Annotation(
				Text( "Overlay Text Here" ),
				Fixed Size( 0 ),
				Text Box( {46, 31, 224, 68} ),
				Text Color( "Medium Dark Red" ),
				Font( "Segoe UI", 14, "Bold" ),
				Filled( 0 )
			)
		)
	)
);

 

Jim
nikles
Level VI

Re: Possible to overlay text on a plot?

Thanks Jim.  That's exactly what I needed.  Works perfectly.

Re: Possible to overlay text on a plot?

Another approach is to add a graphics script. Many graphics functions support the display of text:

index.PNG

Here is an example of another way to add text to a plot:

Names Default to Here( 1 );

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

obj = dt << Graph Builder(
	Size( 534, 456 ),
	Show Control Panel( 0 ),
	Variables( X( :height ), Y( :weight ) ),
	Elements( Points( X, Y, Legend( 3 ) ), Smoother( X, Y, Legend( 4 ) ) )
);

rpt = obj << Report;

rpt[FrameBox(1)] << Add Graphics Script(
	Text( { 55, 160 }, "Here I am!" )
);