|
3 | 3 | % axis_data is the data extracted from the figure, axisName take the |
4 | 4 | % values 'x' 'y' or 'z' |
5 | 5 |
|
6 | | - axis.zeroline = false; |
7 | | - axis.autorange = false; |
8 | | - axis.exponentformat = obj.PlotlyDefaults.ExponentFormat; |
9 | | - axis.tickfont.size = axis_data.FontSize; |
10 | | - axis.tickfont.family = matlab2plotlyfont(axis_data.FontName); |
11 | | - |
12 | | - tl = axis_data.(axisName + "Data"); |
13 | | - tl = length(tl); |
14 | | - |
15 | | - w = axis_data.Position(4); |
16 | | - h = axis_data.Position(3); |
17 | | - |
18 | | - ticklength = min(obj.PlotlyDefaults.MaxTickLength,... |
19 | | - max(tl*w*obj.layout.width,tl*h*obj.layout.height)); |
20 | | - |
21 | | - axis.ticklen = 0.1; %ticklength; |
22 | | - |
23 | | - axiscol = 'rgb(150, 150, 150)'; |
24 | | - |
25 | | - axis.linecolor = axiscol; |
26 | | - axis.tickcolor = axiscol; |
27 | | - axis.tickfont.color = 'black'; |
28 | | - axis.gridcolor = 'rgb(0, 0, 0)'; |
29 | | - |
30 | | - axis.showgrid = true; |
31 | | - |
| 6 | + axiscol = "rgb(150, 150, 150)"; |
32 | 7 | lw = 0.5; |
33 | 8 | linewidth = max(1,lw*obj.PlotlyDefaults.AxisLineIncreaseFactor); |
34 | 9 |
|
35 | | - axis.linewidth = linewidth; |
36 | | - axis.tickwidth = linewidth; |
37 | | - axis.gridwidth = linewidth*1.2; |
38 | | - |
39 | | - %-setting ticks-% |
40 | | - axis.ticks = 'inside'; |
41 | | - axis.mirror = true; |
42 | | - |
43 | | - labels = axis_data.(axisName + "DisplayLabels"); |
44 | | - vals = axis_data.(axisName + "DisplayData"); |
45 | | - |
46 | | - axis.showticklabels = true; |
47 | | - axis.type = 'category'; |
48 | | - axis.autorange = true; |
49 | | - axis.ticktext = labels; |
50 | | - axis.tickvals = vals; |
51 | | - axis.autotick = false; |
52 | | - axis.tickson = 'boundaries'; |
53 | | - |
54 | | - label = axis_data.(axisName + "Label"); |
55 | | - axis.title = label; |
56 | | - axis.titlefont.color = 'black'; |
57 | | - axis.titlefont.size = axis_data.FontSize*1.3; |
58 | | - axis.tickfont.size = axis_data.FontSize*1.15; |
59 | | - axis.titlefont.family = matlab2plotlyfont(axis_data.FontName); |
60 | | - axis.tickfont.family = matlab2plotlyfont(axis_data.FontName); |
61 | | - |
62 | | - if strcmp(axis_data.Visible,'on') |
| 10 | + axis = struct( ... |
| 11 | + "zeroline", false, ... |
| 12 | + "exponentformat", obj.PlotlyDefaults.ExponentFormat, ... |
| 13 | + "ticklen", 0.1, ... |
| 14 | + "linecolor", axiscol, ... |
| 15 | + "tickcolor", axiscol, ... |
| 16 | + "gridcolor", "rgb(0, 0, 0)", ... |
| 17 | + "showgrid", true, ... |
| 18 | + "linewidth", linewidth, ... |
| 19 | + "tickwidth", linewidth, ... |
| 20 | + "gridwidth", linewidth*1.2, ... |
| 21 | + "ticks", "inside", ... |
| 22 | + "mirror", true, ... |
| 23 | + "showticklabels", true, ... |
| 24 | + "type", "category", ... |
| 25 | + "autorange", true, ... |
| 26 | + "ticktext", string(axis_data.(axisName + "DisplayLabels")), ... |
| 27 | + "tickvals", string(axis_data.(axisName + "DisplayData")), ... |
| 28 | + "autotick", false, ... |
| 29 | + "tickson", "boundaries", ... |
| 30 | + "title", axis_data.(axisName + "Label"), ... |
| 31 | + "titlefont", struct( ... |
| 32 | + "color", "black", ... |
| 33 | + "size", axis_data.FontSize*1.3, ... |
| 34 | + "family", matlab2plotlyfont(axis_data.FontName) ... |
| 35 | + ), ... |
| 36 | + "tickfont", struct( ... |
| 37 | + "color", "black", ... |
| 38 | + "size", axis_data.FontSize*1.15, ... |
| 39 | + "family", matlab2plotlyfont(axis_data.FontName) ... |
| 40 | + ) ... |
| 41 | + ); |
| 42 | + |
| 43 | + if axis_data.Visible == "on" |
63 | 44 | axis.showline = true; |
64 | 45 | else |
65 | 46 | axis.showline = false; |
66 | 47 | axis.showticklabels = false; |
67 | | - axis.ticks = ''; |
| 48 | + axis.ticks = ""; |
68 | 49 | end |
69 | 50 | end |
0 commit comments