Skip to content

Commit fae13c8

Browse files
authored
Merge pull request #2 from 3alimoh/3alimoh-patch-2
Update updateSurfaceplot.m
2 parents 4dcf529 + f9f72a3 commit fae13c8

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

plotly/plotlyfig_aux/handlegraphics/updateSurfaceplot.m

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@
4646
%-surface z-%
4747
obj.data{surfaceIndex}.z = image_data.ZData;
4848

49-
%-surface Color-%
50-
obj.data{surfaceIndex}.surfacecolor = image_data.CData;
5149

5250
else
5351

@@ -63,6 +61,27 @@
6361

6462
%-------------------------------------------------------------------------%
6563

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

0 commit comments

Comments
 (0)