Our World Statistics Day conversations have been a great reminder of how much statistics can inform our lives. Do you have an example of how statistics has made a difference in your life? Share your story with the Community!
Choose Language Hide Translation Bar
Staff (Retired)
How to Add an Image to a Graph in JMP 9

Seems like people are starting to discover the new image functionality that was added to JMP 9. And when you are asked the same question by three different people in the same week, you've got to figure it is time for a blog post. The popular question this week is: "How do I add an image to my graph?" There are a couple of ways to do this.

If you have already generated a JMP graph, you can easily add an image via a drag-and-drop operation. Select your image file, drag it over your graph and drop it. The image will appear in the graph.

Yes, that is a picture of me at one of my favorite places to be. No, not at work, but one of my other favorite places to be... the mountains.

You can also add an image in JSL by using Add Image(). Here is a snippet of JSL that creates a window, adds a Graph Box and adds an Image into the Graph Box.

w = New Window( "New Window",

gb = Graph Box(

Frame Size( 500, 500 ),

X Scale( 0, 100 ),

Y Scale( 0, 100 ),

Open("C:\Pictures\me.jpg"),

Bounds(

Left( 20 ),

Right( 80 ),

Top( 80 ),

Bottom( 20 )

)

)

)

);

Notice there are two parameters to the Add Image(). The Open() specifies an image file to use, and the Bounds() specifies how to position and size it in the graph. In this case, I centered the image in the graph and sized it such that there is a 20-unit border around the image. The bounds are specified in the axes coordinates. There are other options you can use with Add Image(). For example, instead of specifying a file to open, you can use an image that is already opened or created in JSL. And instead of specifying the Bounds, you can move the center of the image to a specified position. In this case, the size is determined by the resolution of the image.

img = NewImage("C:\Pictures\me.jpg");

w = New Window( "New Window",

gb = Graph Box(

Frame Size( 500, 500 ),

X Scale( 0, 100 ),

Y Scale( 0, 100 ),

Image(img),

Move(50,50),

)

)

);

Once the image is in the Graph Box, you can modify it interactively. You can click and drag the image to reposition it. If you position your cursor over an edge or a corner of the image, the cursor will change to indicate that you can resize the image. Just click and drag to change the size. If you hold down the shift key before clicking over the corner, the aspect ratio of the image will be preserved.

This is consistent with window resizing in JMP. Holding the Alt key when you click over a corner or edge will allow you to rotate the image. Holding the Alt key when you click inside the image will allow you to crop the image. If you right-mouse-click over the image, you will get the context menu, which will include the Image... submenu. From the Image... submenu, you can size, scale, flip, rotate or apply transparency or a filter to the image. Images support undo/redo, so feel free to experiment. If you don't like the result of an operation, simply use Edit->Undo or Ctrl-Z.

There is a lot more you can do with images in JMP 9. Check the blog for future posts about it or, better still, come to Discovery Summit in September and sit it on my presentation about using images in JMP 9.

Article Labels

There are no labels assigned to this post.

1 Comment
Visitor

Embedding images in JSL scripts - JMP Blog wrote:

[...] a JSL script. A similar discussion arose not long ago and prompted me to write a blog post called How to Add an Image to a Graph in JMP 9. But this time the initial question, and subsequent discussion, specifically asked about embedding [...]