matlab 画图

1.


hFH = imfreehand();   %Choose ROI using freehand tool


画出的是连续的图形.曲线自动闭合且只能画一次.


2.

类似点画线,任意图形.


S.fh = figure('units','pixels',...
              'position',[300 300 400 400],...
              'menubar','none',...
              'name','GUI_39',...
              'numbertitle','off',...
              'resize','off');
S.ax = axes('units','pixels',...
            'position',[20 20 360 350],...
            'Xlim',[0 1],...
            'YLim',[0 1],...
            'drawmode','fast');

S.cm = uicontextmenu;

% Set the uicontextmenu to point to the axes.
set(S.ax, 'buttondownfcn',@ax_bdfcn,'uicontextmenu',S.cm)
hold on, box on  % So that we don't overwrite with each new point drawn.
set(S.fh,'windowbuttonupfcn', @fh_wbufcn);

    function [] = ax_bdfcn(varargin)
    % ButtonDownFcn for the axes.
        % We only want to do something if left clicking.
        if strcmp(get(S.fh,'selectiontype'),'normal')
            % We want to plot dots as long as user holds down mouse button.
            set(S.fh, 'windowbuttonmotionfcn', @fh_wbmfcn)
        end

    end

    function [] = fh_wbmfcn(varargin)
    % The windowbuttonmotionfcn for figure, while button is held only.
        pt = get(S.ax, 'currentpoint');
        plot(pt(1),pt(3),'.','buttondownfcn',@ax_bdfcn,'color',S.COL);
    end

    function [] = fh_wbufcn(varargin)
    % WindowButtonUpFcn for the figure.
        % We want to stop drawing dots when user lets mouse button up.
        set(S.fh, 'windowbuttonmotionfcn', '');
    end


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值