plot_values_contour.m 1.37 KB
Newer Older
Jean-Yves TINEVEZ's avatar
Jean-Yves TINEVEZ committed
1
2
3
4
5
6
7
function hts = plot_values_contour( obj, values, ax )
%PLOT_VALUES_CONTOUR Plot the tissue with the cell exact contours, colored by the specified values.
%
% INPUTS:
%   obj: a deproj object, with N epicells.
%   values - a N x 1 array with values to use for coloring.
%   ax - the axes to plot in.
8
%
Jean-Yves TINEVEZ's avatar
Jean-Yves TINEVEZ committed
9
% OUTPUT:
10
11
%   the handle to the cells patch object.

12
13
    epicells = obj.epicells;
    boundaries = { epicells.boundary };
14
15

    n_objects = numel( boundaries );
16
    if n_objects > 1000, lw = 1; else, lw = 2; end
17

18
    [ X, Y, Z ] = obj.to_matrices();
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
    
    if isempty( values )

        hts = patch( ...
            'XData', X, ...
            'YData', Y, ...
            'ZData', Z, ...
            'FaceColor', 'none', ...
            'EdgeColor', 'k', ...
            'LineWidth', lw, ...
            'Parent', ax );
        
    elseif ischar( values )
        
        hts = patch( ...
            'XData', X, ...
            'YData', Y, ...
            'ZData', Z, ...
            'FaceColor', 'none', ...
            'EdgeColor', values, ...
            'LineWidth', lw, ...
            'Parent', ax );
        
    else
        
        hts = patch( ...
            'XData', X, ...
            'YData', Y, ...
            'ZData', Z, ...
            'FaceVertexCData', values, ...
            'FaceColor', 'flat', ...
            'LineWidth', lw, ...
            'Parent', ax );
    end
53

54
end