|
| 1 | +function obj = updateHeatmap(obj,heatIndex) |
| 2 | + |
| 3 | +%-------------------------------------------------------------------------% |
| 4 | + |
| 5 | +%-HEATMAP DATA STRUCTURE- % |
| 6 | +heat_data = get(obj.State.Plot(heatIndex).Handle); |
| 7 | +%-------------------------------------------------------------------------% |
| 8 | + |
| 9 | +%-heatmap type-% |
| 10 | +obj.data{heatIndex}.type = 'heatmap'; |
| 11 | + |
| 12 | +%-------------------------------------------------------------------------% |
| 13 | + |
| 14 | +%-format data-% |
| 15 | +obj.data{heatIndex}.x = heat_data.XData; |
| 16 | +obj.data{heatIndex}.y = heat_data.YData; |
| 17 | +obj.data{heatIndex}.z = heat_data.ColorData(end:-1:1, :); |
| 18 | + |
| 19 | +%-------------------------------------------------------------------------% |
| 20 | + |
| 21 | +%-heatmap colorscale-% |
| 22 | +cmap = heat_data.Colormap; |
| 23 | +len = length(cmap)-1; |
| 24 | + |
| 25 | +for c = 1: length(cmap) |
| 26 | + col = 255 * cmap(c, :); |
| 27 | + obj.data{heatIndex}.colorscale{c} = { (c-1)/len , ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) ')' ] }; |
| 28 | +end |
| 29 | + |
| 30 | +%-------------------------------------------------------------------------% |
| 31 | + |
| 32 | +%-setting plot-% |
| 33 | +obj.data{heatIndex}.hoverinfo = 'text'; |
| 34 | +obj.data{heatIndex}.text = heat_data.ColorData(end:-1:1, :); |
| 35 | +obj.data{heatIndex}.hoverlabel.bgcolor = 'white'; |
| 36 | + |
| 37 | +%-------------------------------------------------------------------------% |
| 38 | + |
| 39 | +%-show colorbar-% |
| 40 | +obj.data{heatIndex}.showscale = false; |
| 41 | +if strcmpi(heat_data.ColorbarVisible, 'on') |
| 42 | + obj.data{heatIndex}.showscale = true; |
| 43 | +end |
| 44 | + |
| 45 | +%-------------------------------------------------------------------------% |
| 46 | + |
| 47 | +%-hist visible-% |
| 48 | +obj.data{heatIndex}.visible = strcmp(heat_data.Visible,'on'); |
| 49 | + |
| 50 | +%-------------------------------------------------------------------------% |
| 51 | + |
| 52 | +end |
0 commit comments