Subscribe Bookmark RSS Feed

How to "Label by Value" for overlay plots? Scripting Help

jsuls

Community Trekker

Joined:

Jul 30, 2014

I am trying to script an overlay plot. I have everything I want except I can not figure how to add value labels for the line and bar graph. Here is the script I am working with:

obj_1=dt23<<Overlay Plot(X(:Work Week and Year),

  Y(:Average Meters per Lot, :Number of Lots),

  Y Scale(Left,Right),

  :Average Meters per Lot(Connect Points(1)),

  :Number of Lots(Needle(1),Overlay Marker( 0 )),

  Left Axis << {{Format( "Best", 9 ), Min( 0 ),

  Max( 300 ), Inc( 20 ), Minor Ticks( 0 ),Show Major Grid (1)}},

  Right Axis << {{Format( "Best", 9 ), Min( 0 ),

  Max( 150 ), Inc( 30 ),

  Minor Ticks( 0 )}});

obj_1<<Uniform Y Scale(0);

obj_1<<Show Labels(1);

obj_1<<Label By Value(1);

The graph it produces looks like this:

8841_Overlay Plot.JPG

2 REPLIES
robot

Community Trekker

Joined:

Feb 27, 2012

Hi jsuls,

Are you trying to set row labels?  If yes, try turning them on by sending your command to the data table rather than to the overlay plot.  A script may look something like this.

Names Default to Here(1);

bigClass = open("$SAMPLE_DATA/Big Class.jmp");

over1 = bigClass << Overlay Plot( Y( :height, :weight ), Y Scale( Left, Right ) );

Column(bigClass, "name") << label(1); // Set column label.

bigClass << Select Randomly(5) << Label(1) << Clear Select; // Turn on row labels.

ms

Super User

Joined:

Jun 23, 2011

I don't think <<Label by value is supported in Overlay Plot(). It is supported in Chart() and Graph Builder() for categorical x-axis. Chart seem not to support dual y-axes, but Graph Builder is very versatile and can produce a graph very close to your example.

Open("$SAMPLE_DATA/Big Class.jmp") << Graph Builder(

    Variables(X(:age), Y(:weight), Y(:height, Position(1), Side("Right"))),

    Elements(

        Points(X, Y(1), Legend(1), Summary Statistic("Mean")),

        Bar(X, Y(1), Legend(2), Bar Style("Needle"), Label("Label by Value")),

        Points(X, Y(2), Legend(4), Summary Statistic("Mean")),

        Line(X, Y(2), Legend(6))

    ),

    SendToReport(

        Dispatch({}, "weight", ScaleBox, {Max(300)}),

        Dispatch({}, "400", ScaleBox, {Legend Model(6, Properties(0, {Line Color(19)}))})

    ),

    Show Control Panel(0)

);