view +draw/labelPoint.m @ 1037:2d7ba44340d0 feature/burgers1d

Pass scheme specific parameters as cell array. This will enabale constructDiffOps to be more general. In addition, allow for schemes returning function handles as diffOps, which is currently how non-linear schemes such as Burgers1d are implemented.
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Fri, 18 Jan 2019 09:02:02 +0100
parents 48b6fb693025
children
line wrap: on
line source

% Takes a variable number of points as inputs and plots them with a label to the current figure.
%   label_pt(p)
function label_pt(varargin)
    for i = 1:length(varargin)
        try
            placelabel(varargin{i},inputname(i));
        catch e
            error('Could not place label for input %d, ''%s''. Not a valid point',i,inputname(i))
        end
    end
end

function placelabel(pt,str)
    x = pt(1);
    y = pt(2);
    h = line(x,y);
    h.Marker = '.';
    h = text(x,y,str);
    h.HorizontalAlignment = 'center';
    h.VerticalAlignment = 'bottom';
end