Skip to content
Snippets Groups Projects
Commit d3b100a2 authored by Nicola Vigano's avatar Nicola Vigano
Browse files

Figures from pictures: added cmap and possibility to have colorbar without borders

parent 79a64618
No related branches found
No related tags found
No related merge requests found
...@@ -8,6 +8,7 @@ function [f, ax] = gtMakeFigureFromPicture(img, mask, varargin) ...@@ -8,6 +8,7 @@ function [f, ax] = gtMakeFigureFromPicture(img, mask, varargin)
'flip_lr', false, ... 'flip_lr', false, ...
'label', [], ... 'label', [], ...
'clims', [], ... 'clims', [], ...
'cmap', jet, ...
'pixel_to_cm', 0.05, ... 'pixel_to_cm', 0.05, ...
'borders', true, ... 'borders', true, ...
'colorbar', true, ... 'colorbar', true, ...
...@@ -70,7 +71,7 @@ function [f, ax] = gtMakeFigureFromPicture(img, mask, varargin) ...@@ -70,7 +71,7 @@ function [f, ax] = gtMakeFigureFromPicture(img, mask, varargin)
imagesc(permute(img, [2 1 3]), 'parent', ax, ... imagesc(permute(img, [2 1 3]), 'parent', ax, ...
clims_img ); clims_img );
end end
colormap(ax, jet) colormap(ax, conf.cmap)
if (~isempty(conf.extras)) if (~isempty(conf.extras))
if (isempty(conf.pixel_size)) if (isempty(conf.pixel_size))
...@@ -90,12 +91,23 @@ function set_size(f, ax, conf, img) ...@@ -90,12 +91,23 @@ function set_size(f, ax, conf, img)
set(f, 'Units', 'centimeters') set(f, 'Units', 'centimeters')
img_size = size(img) * conf.pixel_to_cm; img_size = size(img) * conf.pixel_to_cm;
if (~conf.borders) if (~conf.borders)
figure_position = [0, 0, img_size]; if (~conf.colorbar)
figure_position = [0, 0, img_size];
else
figure_position = [0, 0, img_size] + [0, 0, 2, 0];
end
set(f, 'Position', figure_position) set(f, 'Position', figure_position)
set(f, 'Paperposition', figure_position) set(f, 'Paperposition', figure_position)
set(ax, 'Units', 'normalized') if (conf.colorbar)
set(ax, 'Position', [0, 0, 1, 1]) cb = colorbar('peer', ax, 'location', 'EastOutside');
set(cb, 'Units', 'centimeters')
position = [img_size(1)+0.35, 0, 0.65, img_size(2)];
set(cb, 'Position', position)
end
set(ax, 'Units', 'centimeters')
set(ax, 'Position', [0, 0, img_size])
fprintf('Axes size: [%g, %g] cm\n', figure_position(3:4)) fprintf('Axes size: [%g, %g] cm\n', figure_position(3:4))
else else
if (~isempty(conf.label)) if (~isempty(conf.label))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment