Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents c527f8b + de5c929 commit 69a0372Copy full SHA for 69a0372
plotly/plotlyfig_aux/handlegraphics/updateImage.m
@@ -87,9 +87,11 @@
87
%-------------------------------------------------------------------------%
88
89
%-image z-%
90
-if(size(image_data.CData,3) > 1)
91
- % TODO: ALLOW FOR TRUE COLOUR SPECS.
92
- obj.data{imageIndex}.z = cdata(:,:,1);
+isrgbimg = (size(image_data.CData,3) > 1);
+
+if isrgbimg
93
+ [IND,colormap] = rgb2ind(cdata, 256);
94
+ obj.data{imageIndex}.z = IND;
95
else
96
obj.data{imageIndex}.z = cdata;
97
end
@@ -137,7 +139,11 @@
137
139
%-COLORSCALE (ASSUMES IMAGE CDATAMAP IS 'SCALED')-%
138
140
141
%-image colorscale-%
-colormap = figure_data.Colormap;
142
143
+if ~isrgbimg
144
+ colormap = figure_data.Colormap;
145
+end
146
147
len = length(colormap) - 1;
148
149
for c = 1:size(colormap, 1)
0 commit comments