From aa634e8debe57766ca22c5f294167c0b3975f554 Mon Sep 17 00:00:00 2001 From: Gilberto Galvis Date: Sun, 8 Aug 2021 19:26:23 -0400 Subject: [PATCH] fix issue #281 --- .../handlegraphics/updateImage.m | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/plotly/plotlyfig_aux/handlegraphics/updateImage.m b/plotly/plotlyfig_aux/handlegraphics/updateImage.m index f1b37783..6dd7e279 100644 --- a/plotly/plotlyfig_aux/handlegraphics/updateImage.m +++ b/plotly/plotlyfig_aux/handlegraphics/updateImage.m @@ -64,8 +64,11 @@ %-------------------------------------------------------------------------% %-image x-% +x = image_data.XData; +cdata = image_data.CData; + if (size(image_data.XData,2) == 2) - obj.data{imageIndex}.x = image_data.XData(1):image_data.XData(2); + obj.data{imageIndex}.x = linspace(x(1), x(2), size(cdata,2)); else obj.data{imageIndex}.x = image_data.XData; end @@ -73,10 +76,12 @@ %-------------------------------------------------------------------------% %-image y-% +y = image_data.YData; + if (size(image_data.YData,2) == 2) - obj.data{imageIndex}.y = image_data.YData(1):image_data.YData(2); + obj.data{imageIndex}.y = linspace(y(1), y(2), size(cdata,1)); else - obj.data{imageIndex}.y = image_data.YData; + obj.data{imageIndex}.y = y; end %-------------------------------------------------------------------------% @@ -84,9 +89,9 @@ %-image z-% if(size(image_data.CData,3) > 1) % TODO: ALLOW FOR TRUE COLOUR SPECS. - obj.data{imageIndex}.z = image_data.CData(:,:,1); + obj.data{imageIndex}.z = cdata(:,:,1); else - obj.data{imageIndex}.z = image_data.CData; + obj.data{imageIndex}.z = cdata; end %-------------------------------------------------------------------------% @@ -121,8 +126,11 @@ %-------------------------------------------------------------------------% %-image zmax-% -axis_data.CLim(2); -% obj.data{imageIndex}.zmax = 255; % comment this as optional +if ~strcmpi(image_data.CDataMapping, 'direct') + obj.data{imageIndex}.zmax = axis_data.CLim(2); +else + obj.data{imageIndex}.zmax = 255; +end %-------------------------------------------------------------------------%