Subscribe Bookmark RSS Feed

Add Image Label to Graph

robot

Community Trekker

Joined:

Feb 27, 2012

Hi,

Using JMP12 and an Expression column, how can I add an image label to a graph?  The mouse over image is great, but I am having trouble getting the image label to stay visible to add to a journal, presentation, etc.  Any suggestions?  Thanks!

Names Default To Here( 1 );

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

dt << New Column( "Image",

       Expression,

       Set

       Formula(

             New Image(

                    Open(

                         "https://upload.wikimedia.org/wikipedia/en/thumb/6/6e/JMPlogo.png/250px-JMPlogo.png",

                           "png"

                    )

             )

       )

);

dt << Set Label Columns( :name, :Image );

dt << Select Where( :name == "LAWRENCE" ) << Label( 1 ) << Clear Select;

dt << Bivariate( Y( :height ), X( :weight ) );

// :name label is visible in graph, :Image label is not.

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

You can pin the label. To do it by hand just mouse over the marker and place the pointer on top of the label box to reveal the pin.

The same thing can be done by sending <<Add Pin Annotation to the FrameBox, but the parameters can be tricky to get right.

I would first pin and position the label by hand and then copy the script. See the example below:

Names Default To Here(1);

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

dt << New Column("Image", Expression, Formula(New Image(Open("$SAMPLE_IMAGES/pi.gif", gif))));

dt << Set Label Columns(:Image);

//dt << Select rows( label_row) << Label( 1 ) << Clear Select;

dt << Bivariate(

    Y(:weight),

    X(:height),

    SendToReport(

        Dispatch(

            {},

            "Bivar Plot",

            FrameBox,

            Add Pin Annotation(

                Seg(Marker Seg(1)),

                Index(39),

                Index Row(-1),

                Origin({70, 172}),

                Offset({30, 16}),

                Tag Line,

                Font("Helvetica", 11, "Plain")

            )

        )

    )

);

   

Current Report() << size window(475, 374);

2 REPLIES
Solution

You can pin the label. To do it by hand just mouse over the marker and place the pointer on top of the label box to reveal the pin.

The same thing can be done by sending <<Add Pin Annotation to the FrameBox, but the parameters can be tricky to get right.

I would first pin and position the label by hand and then copy the script. See the example below:

Names Default To Here(1);

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

dt << New Column("Image", Expression, Formula(New Image(Open("$SAMPLE_IMAGES/pi.gif", gif))));

dt << Set Label Columns(:Image);

//dt << Select rows( label_row) << Label( 1 ) << Clear Select;

dt << Bivariate(

    Y(:weight),

    X(:height),

    SendToReport(

        Dispatch(

            {},

            "Bivar Plot",

            FrameBox,

            Add Pin Annotation(

                Seg(Marker Seg(1)),

                Index(39),

                Index Row(-1),

                Origin({70, 172}),

                Offset({30, 16}),

                Tag Line,

                Font("Helvetica", 11, "Plain")

            )

        )

    )

);

   

Current Report() << size window(475, 374);

robot

Community Trekker

Joined:

Feb 27, 2012

Thanks MS!