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.
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" )} )
)
);
Remove the original title, then add the desired title
db << Remove Axis Label << Add Axis Lable( "label" );
Original label still exists running the following command;
report(obj)[axisbox(2)] << Remove Axis Label << Add Axis Label("Shipped Wafer Volume");
You might have to include the original label as an argument in the first message:
db << Remove Axis Label( "original" );
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.
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.
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),
),
);
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" )} )
)
);
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! ;)
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" )
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
TextEditBox["X Title"]!
so, maybe
current report()[TextEditBox["X Title"]]<< Set Text( "new" )
?
-> no