Identify axes coordinates
allows you to identify the coordinates of
y] = ginput(
n points within Cartesian,
polar, or geographic axes. To choose a point, move your cursor to the desired location and
press either a mouse button or a key on the keyboard. Press the Return key
to stop before all
n points are selected. MATLAB® returns the coordinates of your selected points. If there are no axes, calling
ginput creates a Cartesian axes object.
Identify four points in a set of axes using
ginput. To select
each point, move the cursor to your desired location and press a mouse button or
[x,y] = ginput(4)
x = 0.3699 0.4425 0.5450 0.6130 y = 0.6690 0.5605 0.4719 0.6025
Plot the points.
Identify five coordinates in a set of axes using
select each point, move the cursor to your desired location and press a mouse button,
lowercase letter, uppercase letter, number, or the space bar. Return the mouse buttons
or ASCII numbers of the keys used to select each point.
[x,y,button] = ginput(5); button
button = 3 104 32 51 82
In this case, the coordinates were identified using the right mouse button (3), the lowercase letter h (104), the space bar (32), the number 3 (51), and the uppercase letter R (82).
Create geographic axes and identify the latitude and longitude coordinates of four points. Then, plot the points that you identify.
geoaxes [lat,lon] = ginput(4);
hold on command and the
function to maintain the map limits. Plot the identified points.
hold on geolimits('manual') geoscatter(lat,lon,'filled','b')
n— Number of points
Number of points to identify, specified as a positive integer.
x— First components of identified coordinates
First components of the identified coordinates, returned as a scalar or column vector.
For Cartesian axes, the values are
For polar axes, the values are theta angles. The theta angles are in the range
[tmin, tmin+2*pi], where
tmin is the first
value of the
ThetaLim vector of
the polar axes. The angles are measured from the location of the zero angle in the
direction specified by the
The location of the zero angle is specified by the
For geographic axes, the values are latitudes. Positive values correspond to north and negative values correspond to south.
If you choose points outside the axes limits, the values are relative to
the origin for Cartesian and geographic axes. For polar axes, the values are relative to
y— Second components of identified coordinates
Second components of the identified coordinates, returned as a scalar or column vector.
For Cartesian axes , the values are
For polar axes, the values are radii. Each radius value is greater than or
rmin is the first value
RLim vector of the polar
For geographic axes, the values are longitudes. Positive values correspond to locations east of the origin and negative values correspond to locations west of the origin.
If you choose points outside the axes limits, values are still returned relative to the axes origin.
button— Keys or mouse buttons used to identify points
Keys or mouse buttons used to identify points, returned as a scalar or column vector. Mouse buttons are indicated by 1 for the left button, 2 for the middle, and 3 for the right. Double-clicks are indicated by two values. The first value is 1 for the left mouse button, 2 for the middle, and 3 for the right. The second value is 1.
Keys on the keyboard are indicated by their corresponding ASCII numbers. Taps on a screen are indicated by 1.
For example, call
ginput, click using the middle mouse button,
double-click using the right mouse button, and then press Enter. The
button is a vector containing
[~,~,button] = ginput
button = 2 3 1