Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
18
Добавлен:
09.02.2015
Размер:
146.43 Кб
Скачать

If strcmpi(objTag,'DoNotIgnore')

flag = true;

else

flag = false;

end

EXAMPLE 5: (copy into a file)

function demo

% Listen to zoom events

plot(1:10);

h = zoom;

set(h,'ActionPreCallback',@myprecallback);

set(h,'ActionPostCallback',@mypostcallback);

set(h,'Enable','on');

function myprecallback(obj,evd)

disp('A zoom is about to occur.');

function mypostcallback(obj,evd)

newLim = get(evd.Axes,'XLim');

msgbox(sprintf('The new X-Limits are [%.2f %.2f].',newLim));

Use LINKAXES to link zooming across multiple axes.

See also pan, rotate3d, linkaxes.

Reference page in Help browser

doc zoom

<grid> - Grid lines.

GRID Grid lines.

GRID ON adds major grid lines to the current axes.

GRID OFF removes major and minor grid lines from the current axes.

GRID MINOR toggles the minor grid lines of the current axes.

GRID, by itself, toggles the major grid lines of the current axes.

GRID(AX,...) uses axes AX instead of the current axes.

GRID sets the XGrid, YGrid, and ZGrid properties of

the current axes.

set(AX,'XMinorGrid','on') turns on the minor grid.

See also title, xlabel, ylabel, zlabel, axes, plot, box.

Reference page in Help browser

doc grid

<box> - Axis box.

BOX Axis box.

BOX ON adds a box to the current axes.

BOX OFF takes if off.

BOX, by itself, toggles the box state of the current axes.

BOX(AX,...) uses axes AX instead of the current axes.

BOX sets the Box property of an axes.

See also grid, axes.

Reference page in Help browser

doc box

<rbbox> - Rubberband box.

RBBOX Rubberband box.

RBBOX initializes and tracks a rubberband box in the current figure. It

sets the initial rectangular size of the box to 0, anchors the box at

the figure's CurrentPoint, and begins tracking from this point.

RBBOX(initialRect) specifies the initial location and size of the

rubberband box as [x y width height], where x and y define the

lower-left corner, and width and height define the size. initialRect is

In the units specified by the current figure's Units property, and

measured from the lower-left corner of the figure window. The corner of

the box closest to the pointer position follows the pointer until RBBOX

receives a button-up event.

RBBOX(initialRect,fixedPoint) specifies the corner of the box that

remains fixed. All arguments are in the units specified by the current

figure's Units property, and measured from the lower-left corner of the

figure window. fixedPoint is a two-element vector, [x y]. The tracking

point is the corner diametrically opposite the anchored corner defined

by fixedPoint.

RBBOX(initialRect,fixedPoint,stepSize) specifies how frequently the

rubberband box is updated. When the tracking point exceeds stepSize

figure units, RBBOX redraws the rubberband box. The default stepsize is

1.

finalRect = RBBOX(...) returns a four-element vector, [x y width

height], where x and y are the x and y components of the lower-left

corner of the box, and width and height are the dimensions of the box.

The mouse button must be down when RBBOX is called. RBBOX can be used in

a ButtondownFcn, or in a script or function, along with

WAITFORBUTTONPRESS, to control dynamic behavior.

Example:

figure;

pcolor(peaks);

k = waitforbuttonpress;

point1 = get(gca,'CurrentPoint'); % button down detected

finalRect = rbbox; % return figure units

point2 = get(gca,'CurrentPoint'); % button up detected

point1 = point1(1,1:2); % extract x and y

point2 = point2(1,1:2);

p1 = min(point1,point2); % calculate locations

offset = abs(point1-point2); % and dimensions

x = [p1(1) p1(1)+offset(1) p1(1)+offset(1) p1(1) p1(1)];

y = [p1(2) p1(2) p1(2)+offset(2) p1(2)+offset(2) p1(2)];

hold on

axis manual

plot(x,y,'r','linewidth',5) % draw box around selected region

See also waitforbuttonpress, dragrect.

Reference page in Help browser

doc rbbox

<hold> - Hold current graph.

HOLD Hold current graph

HOLD ON holds the current plot and all axis properties so that

subsequent graphing commands add to the existing graph.

HOLD OFF returns to the default mode whereby PLOT commands erase

the previous plots and reset all axis properties before drawing

new plots.

HOLD, by itself, toggles the hold state.

HOLD does not affect axis autoranging properties.

HOLD ALL holds the plot and the current color and linestyle so

that subsequent plotting commands will not reset the color and

linestyle.

HOLD(AX,...) applies the command to the Axes object AX.

Algorithm note:

HOLD ON sets the NextPlot property of the current figure and

axes to "add".

HOLD OFF sets the NextPlot property of the current axes to

"replace".

See also ishold, newplot, figure, axes.

Reference page in Help browser

doc hold

<axes> - Create axes in arbitrary positions.

AXES Create axes in arbitrary positions.

AXES('position', RECT) opens up an axis at the specified location

and returns a handle to it.

RECT = [left, bottom, width, height] specifies the location and

size of the side of the axis box, relative to the lower-left

corner of the Figure window, in normalized units where (0,0)

is the lower-left corner and (1.0,1.0) is the upper-right.

AXES, by itself, creates the default full-window axis and returns

a handle to it.

AXES(H) makes the axis with handle H current.

Execute GET(H) to see a list of axes object properties and

their current values. Execute SET(H) to see a list of axes

object properties and legal property values.

See also subplot, axis, figure, gca, cla.

Reference page in Help browser

doc axes

<subplot> - Create axes in tiled positions.

SUBPLOT Create axes in tiled positions.

H = SUBPLOT(m,n,p), or SUBPLOT(mnp), breaks the Figure window

into an m-by-n matrix of small axes, selects the p-th axes for

the current plot, and returns the axes handle. The axes are

counted along the top row of the Figure window, then the second

row, etc. For example,

SUBPLOT(2,1,1), PLOT(income)

SUBPLOT(2,1,2), PLOT(outgo)

plots income on the top half of the window and outgo on the

bottom half. If the CurrentAxes is nested in a uipanel the

panel is used as the parent for the subplot instead of the

current figure.

SUBPLOT(m,n,p), if the axes already exists, makes it current.

SUBPLOT(m,n,p,'replace'), if the axes already exists, deletes it and

creates a new axes.

SUBPLOT(m,n,p,'align') places the axes so that the plot boxes

are aligned, but does not prevent the labels and ticks from

overlapping.

SUBPLOT(m,n,P), where P is a vector, specifies an axes position

that covers all the subplot positions listed in P.

SUBPLOT(H), where H is an axes handle, is another way of making

an axes current for subsequent plotting commands.

SUBPLOT('position',[left bottom width height]) creates an

axes at the specified position in normalized coordinates (in

in the range from 0.0 to 1.0).

SUBPLOT(..., PROP1, VALUE1, PROP2, VALUE2, ...) sets the

specified property-value pairs on the subplot axes. To add the

subplot to a specific figure pass the figure handle as the

value for the 'Parent' property.

If a SUBPLOT specification causes a new axes to overlap an

existing axes, the existing axes is deleted - unless the position

of the new and existing axes are identical. For example,

the statement SUBPLOT(1,2,1) deletes all existing axes overlapping

the left side of the Figure window and creates a new axes on that

side - unless there is an axes there with a position that exactly

matches the position of the new axes (and 'replace' was not specified),

in which case all other overlapping axes will be deleted and the

matching axes will become the current axes.

SUBPLOT(111) is an exception to the rules above, and is not

identical in behavior to SUBPLOT(1,1,1). For reasons of backwards

compatibility, it is a special case of subplot which does not

immediately create an axes, but instead sets up the figure so that

the next graphics command executes CLF RESET in the figure

(deleting all children of the figure), and creates a new axes in

the default position. This syntax does not return a handle, so it

is an error to specify a return argument. The delayed CLF RESET

is accomplished by setting the figure's NextPlot to 'replace'.

Be aware when creating subplots from scripts that the Position

property of subplots is not finalized until either a drawnow

command is issued, or MATLAB returns to await a user command.

That is, the value obtained for subplot i by the command

get(h(i),'Position') will not be correct until the script

refreshes the plot or exits.

See also gca, gcf, axes, figure, uipanel

Reference page in Help browser

doc subplot

Соседние файлы в папке Библиотеки Matlab