cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
illinitom
Level II

Change Y-axis title

I would like to change the y-axis title of an overlay plot, but not sure how to achieve that.  I can "Add Axis Label" to chart, but that appends only.  Ideally, I would like the default label removed and replaced with more descriptive text.

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Change Y-axis title

In Graph Builder, the Y axis label is a Text Edit Box.  The following script shows how to change it.

Graph Builder(
	Variables( X( :ww ), Y( :ww ), Y( :Yield, Position( 1 ), Side( "Right" ) ) ),
	Elements(
		Bar( X, Y( 1 ), Legend( 1 ), Summary Statistic( "N" ) ),
		Line( X, Y( 2 ), Legend( 2 ) )
	),
	SendToReport(
		Dispatch( {}, "Y title", TextEditBox, {Set Text( "This is the change" )} )
	)
);
Jim

View solution in original post

9 REPLIES 9

Re: Change Y-axis title

Remove the original title, then add the desired title

db << Remove Axis Label << Add Axis Lable( "label" );
illinitom
Level II

Re: Change Y-axis title

Original label still exists running the following command;

 

report(obj)[axisbox(2)] << Remove Axis Label << Add Axis Label("Shipped Wafer Volume");

 

 

Re: Change Y-axis title

You might have to include the original label as an argument in the first message:

db << Remove Axis Label( "original" );
Jeff_Perkinson
Community Manager Community Manager

Re: Change Y-axis title

The answers so far have focused on scripting but if you aren't writing a script and want to change it interactively, you can click on the label and edit it.

 

JMPScreenSnapz064.png

 

If you do want to script it, after making the change this getting the script for the platform will show you how to change it.

 

Finally, if you're using the Overlay Plot platform you should be aware that it's being (slowly) depreacated in favor of Graph Builder. You should be able to use Graph Builder for most everythign you can do in Overlay Plot.

 

-Jeff
illinitom
Level II

Re: Change Y-axis title

Sorry, I wasn't clear.  I am using Graph Builder.  Below is the example code.  I was hoping these edits could be handled within the GraphBuilder() function itself, but can't seem to find correct syntax in Help manuals.

 

 obj = Graph Builder( 
	Variables( X( :WW), Y(:WW), Y( :YIELD, Position(1), Side("Right" )) ), 
	Elements(
		Bar(X, Y( 1), , Bar Style("Side by side"), Summary Statistic("N") ),
		Line (X, Y( 2), Summary Statistic("Mean")	),
		Title(prog),
		//show legend(1),
		),

);
txnelson
Super User

Re: Change Y-axis title

In Graph Builder, the Y axis label is a Text Edit Box.  The following script shows how to change it.

Graph Builder(
	Variables( X( :ww ), Y( :ww ), Y( :Yield, Position( 1 ), Side( "Right" ) ) ),
	Elements(
		Bar( X, Y( 1 ), Legend( 1 ), Summary Statistic( "N" ) ),
		Line( X, Y( 2 ), Legend( 2 ) )
	),
	SendToReport(
		Dispatch( {}, "Y title", TextEditBox, {Set Text( "This is the change" )} )
	)
);
Jim
Steven_Moore
Level VI

Re: Change Y-axis title

Thanks Jeff;  You can do the same thing in Graph Builder.  I do that or, if I want to save the script, I just edit the script to the Y-axis name I want......and I am nobody's script writer! ;)

Steve
hogi
Level XII

Re: Change Y-axis title

How do I change the X axis label in Graph Builder using JSL - if the graph already exists?

 

From the enhanced log, I get e.g. :

Names Default to Here(1);
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
gb = dt << Graph Builder(
	Variables( X( :height ), Y( :weight ), Overlay( :sex ) ),
	Elements( Points( X, Y, Legend( 1 ) ), Smoother( X, Y, Legend( 2 ) ) ),
	SendToReport( Dispatch( {}, "X title", TextEditBox, {Set Text( "new" )} ))
);

 

So,

gb << SendToReport( Dispatch( {}, "X title", TextEditBox, {Set Text( "xxx" )} ))

is an easy trick ( Talking to Display boxes ) but should be avoided:
https://community.jmp.com/t5/Discussions/JMP-Script-Dispatch-Function/m-p/256386/highlight/true#M503... .

 

Sending a message like this one

current report()[TextEditBox(3)]<< Set Text( "new" )

...works, but tomorrow (after removing the title of the graph) it could be 

current report()[TextEditBox(2)]<< Set Text( "new" )

 

Is there something more robust?
maybe in analogy to the SendToReport/Dispatch approach, something like:

 

current report()[TextEditBox("X title")]<< Set Text( "new" )

 

hogi
Level XII

Re: Change Y-axis title

Maybe a hint:
When I erroneously write

gb << SendToReport( Dispatch( {}, "X_Title", TextEditBox, {Set Text( "xxx" )} ))

[please notice the underscore between X and title]

 

... I get the error message

hogi_1-1717231352941.png

 

TextEditBox["X Title"]!

 

so, maybe 

current report()[TextEditBox["X Title"]]<< Set Text( "new" )

?

 

-> no