Commit e6bcc04b authored by Jean-Yves TINEVEZ's avatar Jean-Yves TINEVEZ
Browse files

Set the colorbar properly on the ellipse fit figure.

parent 06b7ea29
function hts = add_ellipse_variable( obj, values, ax )
function hts = add_ellipse_variable( obj, values, cmap, ax )
%ADD_ELLIPSE_VARIABLE Plots the ellipses, colored by the specified values.
epicells = obj.epicells;
n_objects = numel( epicells );
hts = NaN( n_objects, 1 );
hts = NaN( 2 * n_objects, 1 );
minv = min( values );
maxv = max( values );
colors = hsv( 256 );
colors = colormap( cmap );
idx = @(v) 1 + round( (v - minv)/(maxv - minv) * ( size( colors, 1 ) - 1 ) );
for i = 1 : n_objects
o = epicells( i );
h = o.plot_ellipse_3d( 23, ax );
h1 = o.plot_ellipse_3d( 23, ax );
h2 = o.plot_ellipse_3d( 3, ax );
hts( i ) = h;
hts( 2 * i - 1 ) = h1;
hts( 2 * i ) = h1;
val = values( i );
j = idx( val );
set( h, ...
set( [ h1 h2 ], ...
'Color', colors( j, : ), ...
'LineWidth', 2 )
end
set( ax, 'CLim', [ minv maxv ] )
end
......@@ -17,7 +17,7 @@ classdef deproj
%% Plotting routines.
methods
%% Generate figures.
% Figure with the local plan orientation for a collection of epicells.
......@@ -48,7 +48,7 @@ classdef deproj
hts = add_plot_variable( obj, values, ax )
%Plots the ellipses, colored by the specified values.
hts = add_ellipse_variable( obj, values, ax )
hts = add_ellipse_variable( obj, values, cmap, ax )
end
......
......@@ -9,11 +9,9 @@ function [ hf, he ] = plot_fit_ellipse( obj, scale_bar_length )
hold on
axis equal
% TODO set colormap, pass it to colorbar and set caxis limits from
% values. And does this all automatically.
values = rad2deg( [ obj.epicells.proj_direction ]' );
he = add_ellipse_variable( obj, values, gca );
cmap = 'hsv';
he = add_ellipse_variable( obj, values, cmap, gca );
add_plot_scalebar( obj, scale_bar_length, gca );
axis( gca, 'off' )
......
......@@ -38,7 +38,7 @@ function [ f3d, v ] = fit_ellipse_3d( p, E, method )
f( 1 ) = f( 1 ) + c( 1 );
f( 2 ) = f( 2 ) + c( 2 );
f3d = [ f(1:2) c(3) f(3:5) ];
f3d = double( [ f(1:2) c(3) f(3:5) ] );
end
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment