How Do I Extract Coordinates from a Plot?

To select a coordinate in a Mathematica plot or two-dimensional graphic, select the graphic, press the CONTROL key, and press the left mouse button. A small dot at the position of the mouse pointer and the coordinates will be displayed in the lower-left corner of the window. To see or use these coordinates, choose Copy from the Edit menu, unselect the graphic, and paste. The coordinates will show up as a Mathematica list in a new input cell.



How Can I Select Multiple Points?

To select multiple coordinates in a Mathematica plot or two-dimensional graphic, select the graphic, press the CONTROL key, and click the mouse button over the points you are interested in. You will see the current coordinates displayed in the lower-left corner of the window. To see or use these coordinates, choose Copy from the Edit menu, unselect the graphic, and paste. The coordinates will show up as a Mathematica list in a new input cell. Try this procedure with the plot below. Move the text cursor between the braces of the ListPlot command after you finish, paste, and evaluate the resulting input cell. You can also select a list of points by holding down the CONTROL key and dragging the mouse.

[Graphics:Images/index_gr_1.gif]

[Graphics:Images/index_gr_2.gif]

[Graphics:Images/index_gr_3.gif]
[Graphics:Images/index_gr_4.gif]

You should see something like this.

[Graphics:Images/index_gr_5.gif]

[Graphics:Images/index_gr_6.gif]

Return to Top

For What Can I Use This?

Zooming

Selecting points in a graphic and passing them to the PlotRange option is a very convenient way to enlarge an area of interest in a graphic.

[Graphics:Images/index_gr_7.gif]

[Graphics:Images/index_gr_8.gif]

PlotRange expects the bounds in the form [Graphics:Images/index_gr_9.gif]. Transpose converts the selected points into this form.

[Graphics:Images/index_gr_10.gif]

[Graphics:Images/index_gr_11.gif]

[Graphics:Images/index_gr_12.gif]


Finding Start Points for FindRoot

Selecting points in graphics is also very helpful in finding starting points for numerical solvers like FindRoot.

[Graphics:Images/index_gr_13.gif]

[Graphics:Images/index_gr_14.gif]

Selecting a point around -1.5 gives the minimum on the negative xaxis.

[Graphics:Images/index_gr_15.gif]
[Graphics:Images/index_gr_16.gif]

Selecting a point to the right of the first maximum of the positive xaxis gives the minimum next to it.

[Graphics:Images/index_gr_17.gif]
[Graphics:Images/index_gr_18.gif]


Selecting Pieces of Images

Note: The following is an example from the Digital Image Processing application package.

Finally, using a real image, we show an example of edge detection in a rectangular region of interest. This loads the example image.

[Graphics:Images/index_gr_19.gif]
[Graphics:Images/index_gr_20.gif]

[Graphics:Images/index_gr_21.gif]

[Graphics:Images/index_gr_22.gif]

Here we define a region of interest, denoted roi. To select a particular region, click the displayed graphics object. In Windows press the CONTROL key and click a point of interest. The point will be selected. This may be repeated for as many points as desired. Use the Copy and Paste command to paste the recorded list of positions to any cell or expression in the notebook. Applying Round converts these values to integers.

[Graphics:Images/index_gr_23.gif]

This shows the result of applying a Sobel edge detector to the region defined by roi.

[Graphics:Images/index_gr_24.gif]

[Graphics:Images/index_gr_25.gif]


Return to Top


 © 2008 Wolfram Research, Inc.  Terms of Use  Privacy Policy | [ja] |
Sign up for our newsletter: