cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
miguello
Level VII

Text position in Graph Box - is there a bug?

Here's the script that roughly does what I need, at least visually:

Names Default To Here( 1 );

New Window( "Example",
	Graph Box(

		Pen Color("red");
		Back Color ("Light Yellow");
		Text Color( "red" );
		Text( Boxed, Erased, {20, 85}, "MyTextHere" );
		Text( Boxed, Erased, {20, 75}, "AnotherTextHere" );
	)
);

And I need several labels styled just like that.

2026-09-22 16_25_35-Example 13 - JMP [2].png

But I need them left justified - and they are center justified in this image.
There is no separate "Left Justified" - it should be like that by default. But as soon as you include "Boxed" - it becomes Center Justified.

The script in the manual (https://www.jmp.com/support/help/en/19.0/#page/jmp/add-text.shtml#) has this:

mytext = New Window( "Adding Text",
	Graph Box(
		Frame Size( 200, 200 ),
		Y Scale( 0, 15 ),
		X Scale( 0, 10 ),
		Text Size( 9 );
		Text Color( "blue" );
		Text( {5, 1}, "Left Justified" );
		Text( Center Justified, {5, 2}, "Center Justified" );
		Text( Right Justified, {5, 3}, "Right Justified" );
		Fill Color( 4 );
		Rect( 5, 8, 9, 5, 1 );
		Text( Erased, {6, 6}, "Erased" );
		Text( Boxed, {6, 10}, "Boxed" );
		Text( Clockwise, {4, 10}, "Clockwise" );
		Text( Counterclockwise, {3, 5}, "Counterclockwise" );
	)
);

and according to the manual it produces this plot:

Text.png

While if I run it on my JMP I see this:
2026-09-22 16_27_47-Adding Text - JMP [2].png

The Boxed text becomes Center Justified.
Is this a bug? Any way to fix this? I do need boxed and erased style to preserve feel and look when switching from Text Annotations to the Graphics Script.


The reason I switch from Text Annotation to Graphics Script is to be able to refresh those labels on redraw - for instance, after Automatic Recalc. Is there a way to do that on Text Annotations, or do I have to switch to Graphics Script?

3 REPLIES 3
jthi
Super User

Re: Text position in Graph Box - is there a bug?

There is a wish list item created by Jim Provide a "Left Justify" option to the Graphic Text() function

-Jarmo
miguello
Level VII

Re: Text position in Graph Box - is there a bug?

Left a comment there. Any tips on estimating the size of the text to be able to place it at the left boundary of the plot?

jthi
Super User

Re: Text position in Graph Box - is there a bug?

No good options, but I think TextBox with the same text could be the same size but you will get it in pixels and if you need to place it based on coordinates you will have to do some calculations.

 

Names Default To Here(1);

nw = New Window("", << Window View("Invisible"),
	Text Box("MyTextHere"),
	Text Box("AnotherTextHere")
);

tbs = nw << XPath("//TextBox");
sizes = tbs << get size;
nw << Close Window;

show(sizes); // sizes = {{65, 17}, {92, 17}};

Write();

 

There is also Pixel Text() which could be easier option depending on your use case

 

View more...
Names Default To Here(1);

nw = New Window("", <<Window View("Invisible"), Text Box("MyTextHere"), Text Box("AnotherTextHere"));

tbs = nw << XPath("//TextBox");
sizes = tbs << get size;
texts = tbs << get text;
nw << Close Window;

aa = Associative Array(texts, sizes);
Show(sizes); // sizes = {{65, 17}, {92, 17}};

nw = New Window("Example",
	Graph Box(
		Pixel Origin(20, 85); // in axis coordinates
		Pen Color("red");
		Fill Color("Light Yellow");
		Text Color("red");
		Pixel Path(0, 0, path = [-3 -15 1, 67 -15 2, 67 5 2, -3 5 -2], 1, 1);
		Pixel Path(0, 0, path = [-3 -15 1, 67 -15 2, 67 5 2, -3 5 -2], 0, 1);
		Pixel Text({0, 0}, "MyTextHere");
		Pixel Origin(20, 75);
		
		Pixel Path(0, 0, path = [-3 -15 1, 94 -15 2, 94 5 2, -3 5 -2], 1, 1);
		Pixel Path(0, 0, path = [-3 -15 1, 94 -15 2, 94 5 2, -3 5 -2], 0, 1);
		Pixel Text({0, 0}, "AnotherTextHere");
	)
);

Write();

jthi_0-1790191950384.png

 

 

-Jarmo

Recommended Articles