|
| 1 | +function [axis] = extractHeatmapAxisData(obj,axis_data,axisName) |
| 2 | +%extract information related to each axis |
| 3 | +% axis_data is the data extrated from the figure, axisName take the |
| 4 | +% values 'x' 'y' or 'z' |
| 5 | + |
| 6 | + |
| 7 | +%-------------------------------------------------------------------------% |
| 8 | + |
| 9 | +%-axis-side-% |
| 10 | +% axis.side = eval(['axis_data.' axisName 'AxisLocation;']); |
| 11 | + |
| 12 | +%-------------------------------------------------------------------------% |
| 13 | + |
| 14 | +%-axis zeroline-% |
| 15 | +axis.zeroline = false; |
| 16 | + |
| 17 | +%-------------------------------------------------------------------------% |
| 18 | + |
| 19 | +%-axis autorange-% |
| 20 | +axis.autorange = false; |
| 21 | + |
| 22 | +%-------------------------------------------------------------------------% |
| 23 | + |
| 24 | +%-axis exponent format-% |
| 25 | +axis.exponentformat = obj.PlotlyDefaults.ExponentFormat; |
| 26 | + |
| 27 | +%-------------------------------------------------------------------------% |
| 28 | + |
| 29 | +%-axis tick font size-% |
| 30 | +axis.tickfont.size = axis_data.FontSize; |
| 31 | + |
| 32 | +%-------------------------------------------------------------------------% |
| 33 | + |
| 34 | +%-axis tick font family-% |
| 35 | +axis.tickfont.family = matlab2plotlyfont(axis_data.FontName); |
| 36 | + |
| 37 | +%-------------------------------------------------------------------------% |
| 38 | + |
| 39 | +tl = eval(['axis_data.' axisName 'Data;']); |
| 40 | +tl = length(tl); |
| 41 | + |
| 42 | +w = axis_data.Position(4); |
| 43 | +h = axis_data.Position(3); |
| 44 | + |
| 45 | +ticklength = min(obj.PlotlyDefaults.MaxTickLength,... |
| 46 | + max(tl*w*obj.layout.width,tl*h*obj.layout.height)); |
| 47 | + |
| 48 | +%-axis ticklen-% |
| 49 | +axis.ticklen = 0.1; %ticklength; |
| 50 | + |
| 51 | +%-------------------------------------------------------------------------% |
| 52 | + |
| 53 | +% col = eval(['255*axis_data.' axisName 'Color;']); |
| 54 | +axiscol = 'rgb(150, 150, 150)'; |
| 55 | +% axiscol = 'black'; |
| 56 | + |
| 57 | +%-axis linecolor-% |
| 58 | +axis.linecolor = axiscol; |
| 59 | +%-axis tickcolor-% |
| 60 | +axis.tickcolor = axiscol; |
| 61 | +%-axis tickfont-% |
| 62 | +axis.tickfont.color = 'black'; |
| 63 | +%-axis grid color-% |
| 64 | +axis.gridcolor = axiscol; |
| 65 | + |
| 66 | +%-------------------------------------------------------------------------% |
| 67 | + |
| 68 | +axis.showgrid = false; |
| 69 | + |
| 70 | +%-------------------------------------------------------------------------% |
| 71 | + |
| 72 | +lw = 0.5; |
| 73 | +linewidth = max(1,lw*obj.PlotlyDefaults.AxisLineIncreaseFactor); |
| 74 | + |
| 75 | +%-axis line width-% |
| 76 | +axis.linewidth = linewidth; |
| 77 | +%-axis tick width-% |
| 78 | +axis.tickwidth = linewidth; |
| 79 | +%-axis grid width-% |
| 80 | +axis.gridwidth = linewidth; |
| 81 | + |
| 82 | +%-------------------------------------------------------------------------% |
| 83 | + |
| 84 | +axis.ticks = 'inside'; |
| 85 | +axis.mirror = true; |
| 86 | + |
| 87 | +labels = eval(['axis_data.' axisName 'DisplayLabels;']); |
| 88 | +vals = eval(['axis_data.' axisName 'DisplayData;']); |
| 89 | + |
| 90 | +axis.showticklabels = true; |
| 91 | +axis.type = 'category'; |
| 92 | +axis.autorange = true; |
| 93 | +axis.ticktext = labels; |
| 94 | +axis.tickvals = vals; |
| 95 | +axis.showtickprefix = 'none'; |
| 96 | + |
| 97 | +%-------------------------------LABELS------------------------------------% |
| 98 | + |
| 99 | +label = eval(['axis_data.' axisName 'Label;']); |
| 100 | + |
| 101 | +%-------------------------------------------------------------------------% |
| 102 | + |
| 103 | +%-title-% |
| 104 | +axis.title = label; |
| 105 | + |
| 106 | +%-------------------------------------------------------------------------% |
| 107 | + |
| 108 | +%-axis title font color-% |
| 109 | +axis.titlefont.color = 'black'; |
| 110 | + |
| 111 | +%-------------------------------------------------------------------------% |
| 112 | + |
| 113 | +%-axis title font size-% |
| 114 | +axis.titlefont.size = axis_data.FontSize*1.2; |
| 115 | + |
| 116 | +%-------------------------------------------------------------------------% |
| 117 | + |
| 118 | +%-axis title font family-% |
| 119 | +axis.titlefont.family = matlab2plotlyfont(axis_data.FontName); |
| 120 | + |
| 121 | +%-------------------------------------------------------------------------% |
| 122 | + |
| 123 | +if strcmp(axis_data.Visible,'on') |
| 124 | + %-axis showline-% |
| 125 | + axis.showline = true; |
| 126 | +else |
| 127 | + %-axis showline-% |
| 128 | + axis.showline = false; |
| 129 | + %-axis showticklabels-% |
| 130 | + axis.showticklabels = false; |
| 131 | + %-axis ticks-% |
| 132 | + axis.ticks = ''; |
| 133 | +end |
| 134 | + |
| 135 | +%-------------------------------------------------------------------------% |
| 136 | +end |
| 137 | + |
| 138 | + |
0 commit comments