We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f7d8f24 commit de5c929Copy full SHA for de5c929
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