function lineplot(data,mask,img)
    % Form figure
    figure(1); 
    
    % Do image subplot first
    subplot(1,2,1);
    imshow(im2uint8(cat(3,img,img,img)),[]);  
    hold('on');
    handle_data = imshow(data,[]);
        
    m = size(get(gcf,'colormap'),1);
    n = ceil(m/4);
    u = [(1:1:n)/n ones(1,n-1) (n:-1:1)/n]';
    g = ceil(n/2) - (mod(m,4)==1) + (1:length(u))';
    r = g + n;
    b = g - n;
    g(g>m) = [];
    r(r>m) = [];
    b(b<1) = [];
    J = zeros(m,3);
    J(r,1) = u(1:length(r));
    J(g,2) = u(1:length(g));
    J(b,3) = u(end-length(b)+1:end);
    set(gcf, 'Colormap', J); 
    
    alphamap = mask.*0.7;
    set(handle_data,'AlphaData', alphamap);
    caxis(gca,[prctile(data(mask),5) prctile(data(mask),95)]);
    
    % Set line
    handle_line = imline(gca);          
    
    addNewPositionCallback(handle_line,@(pos)callback_line(pos));
    
    % Call it to initialize
    callback_line(getPosition(handle_line));
    
    function callback_line(pos)       
        % Must get coordinates of line, then interpolate data
        p1 = pos(1,:);
        p2 = pos(2,:);

        % Interpolate 100 points between p1 and p2
        n = 100;
        coords_x = linspace(p1(1),p2(1),n);
        coords_y = linspace(p1(2),p2(2),n);

        val_interp = interp2(data,coords_x,coords_y);

        subplot(1,2,2);
        plot(1:n,val_interp,'ro');
    end
end

