diff --git a/library_plots/xp_matrix_imagesc.m b/library_plots/xp_matrix_imagesc.m index 2824c27..ac4dc25 100644 --- a/library_plots/xp_matrix_imagesc.m +++ b/library_plots/xp_matrix_imagesc.m @@ -15,8 +15,8 @@ function xp_matrix_imagesc (xp,options) if ~isfield(options,'ylims'); options.ylims = []; end if ~isfield(options,'xdat'); options.xdat= []; end if ~isfield(options,'ydat'); options.ydat = []; end - if ~isfield(options,'clims'); options.clims = []; end - if ~isfield(options,'show_colorbar'); options.show_colorbar = 0; end + if ~isfield(options,'zlims'); options.zlims = []; end + if ~isfield(options,'do_colorbar'); options.do_colorbar = false; end % Display_mode: 0-Just plot directly % 1-Plot as an image (cdata) % 2-Save to a figure file @@ -26,26 +26,27 @@ function xp_matrix_imagesc (xp,options) ylims = options.ylims; xdat = options.xdat; ydat = options.ydat; - clims = options.clims; - show_colorbar = options.show_colorbar; + zlims = options.zlims; + do_colorbar = options.do_colorbar; - if transpose_on; + if transpose_on d = xp.data{1}'; else d = xp.data{1}'; end - if ~isempty(clims) - imagesc(xdat,ydat,d,clims); + if ~isempty(zlims) + imagesc(xdat,ydat,d,zlims); else imagesc(xdat,ydat,d); end + set(gca,'YDir','normal'); if ~isempty(xlims); xlim(xlims); end if ~isempty(ylims); ylim(ylims); end - if show_colorbar + if do_colorbar colorbar; end diff --git a/library_plots/xp_subplot_grid.m b/library_plots/xp_subplot_grid.m index 285e8a0..374caf1 100644 --- a/library_plots/xp_subplot_grid.m +++ b/library_plots/xp_subplot_grid.m @@ -13,8 +13,10 @@ op = struct_addDef(op,'display_mode',0); op = struct_addDef(op,'subplotzoom_enabled',1); op = struct_addDef(op,'legend1',[]); + op = struct_addDef(op,'do_colorbar',false); op = struct_addDef(op,'max_legend',20); op = struct_addDef(op,'force_rowvect',false); + op = struct_addDef(op,'zlims',[]); % Display_mode: 0-Just plot directly % 1-Plot as an image (cdata) % 2-Save to a figure file @@ -23,6 +25,8 @@ display_mode = op.display_mode; subplotzoom_enabled = op.subplotzoom_enabled; legend1 = op.legend1; + do_colorbar = op.do_colorbar; + zlims = op.zlims; % This might be used for setting the colorbar limits (clims), but cannot get it working with subplot_grid if verLessThan('matlab','8.4') && display_mode == 1; warning('Display_mode==1 might not work with earlier versions of MATLAB.'); end if transpose_on && ismatrix(xp) @@ -68,6 +72,11 @@ % Place a legend in the 1st subplot legend(legend1{1:min(end,op.max_legend)}); end + if i == 1 && j == 1 && do_colorbar + colorbar; + %hsg.colorbar; + %hsg.colorbar([],zlims); + end end end