Skip to content

Commit 1cb8821

Browse files
authored
Merge pull request #289 from 3alimoh/master
Fixing Issue #255 and #258
2 parents 4985514 + d760a24 commit 1cb8821

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

plotly/plotlyfig_aux/handlegraphics/updateSurfaceplot.m

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
%-SURFACE DATA STRUCTURE- %
1010
image_data = get(obj.State.Plot(surfaceIndex).Handle);
11-
11+
figure_data = get(obj.State.Figure.Handle);
1212
%-AXIS DATA-%
1313
eval(['xaxis = obj.layout.xaxis' num2str(xsource) ';']);
1414
eval(['yaxis = obj.layout.yaxis' num2str(ysource) ';']);
@@ -46,6 +46,7 @@
4646
%-surface z-%
4747
obj.data{surfaceIndex}.z = image_data.ZData;
4848

49+
4950
else
5051

5152
%-surface type-%
@@ -60,6 +61,24 @@
6061

6162
%-------------------------------------------------------------------------%
6263

64+
65+
%-image colorscale-%
66+
67+
cmap = figure_data.Colormap;
68+
69+
for c = 1: length(cmap)
70+
x1=(c-1)/length(cmap);
71+
if x1 > 0.99
72+
x=round(x1);
73+
else
74+
x=x1;
75+
end
76+
obj.data{surfaceIndex}.colorscale{c} = { x , ['rgb(' num2str(255*cmap(c,1)) ',' num2str(255*cmap(c,2)) ',' num2str(255*cmap(c,3)) ',' ')' ] };
77+
end
78+
79+
obj.data{surfaceIndex}.surfacecolor = image_data.CData;
80+
%-------------------------------------------------------------------------%
81+
6382
%-surface name-%
6483
obj.data{surfaceIndex}.name = image_data.DisplayName;
6584

0 commit comments

Comments
 (0)