Skip to content

Commit c617eae

Browse files
fix issues with contour functions used in ssim_baselines/matlab/contour-plots/
1 parent 132a238 commit c617eae

File tree

7 files changed

+58
-23
lines changed

7 files changed

+58
-23
lines changed

Diff for: plotly/plotlyfig.m

+2-1
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,8 @@ function delete(obj)
10021002
|| strcmpi(fieldname,'mesh3d') || strcmpi(fieldname,'bar') ...
10031003
|| strcmpi(fieldname,'scatterpolar') || strcmpi(fieldname,'barpolar') ...
10041004
|| strcmpi(fieldname,'scene') || strcmpi(fieldname,'layout') ...
1005-
|| strcmpi(fieldname,'heatmap') ...
1005+
|| strcmpi(fieldname,'heatmap') || strcmpi(fieldname,'xaxis') ...
1006+
|| strcmpi(fieldname,'yaxis') ...
10061007
)
10071008
fprintf(['\nWhoops! ' exception.message(1:end-1) ' in ' fieldname '\n\n']);
10081009
end

Diff for: plotly/plotlyfig_aux/core/updateData.m

+2
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@
150150
if strcmpi(xaxis.type, 'category') && ...
151151
~strcmp(obj.data{dataIndex}.type,'box')
152152
obj.data{dataIndex}.x = get(obj.State.Plot(dataIndex).AssociatedAxis,'XTickLabel');
153+
eval(['obj.layout.xaxis' num2str(xsource) '.autotick=true;']);
153154
end
154155

155156
% check for yaxis dates
@@ -161,6 +162,7 @@
161162
if strcmpi(yaxis.type, 'category') && ...
162163
~strcmp(obj.data{dataIndex}.type,'box')
163164
obj.data{dataIndex}.y = get(obj.State.Plot(dataIndex).AssociatedAxis,'YTickLabel');
165+
eval(['obj.layout.yaxis' num2str(xsource) '.autotick=true;']);
164166
end
165167
catch
166168
% TODO to the future

Diff for: plotly/plotlyfig_aux/handlegraphics/updateContour3.m

+11-11
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@
6565

6666
%-setting for contour lines z-direction-%
6767
if length(contour_data.LevelList) > 1
68-
zstart = contour_data.LevelList(1);
69-
zend = contour_data.LevelList(end);
70-
zsize = mean(diff(contour_data.LevelList));
68+
zstart = contour_data.TextList(1);
69+
zend = contour_data.TextList(end);
70+
zsize = mean(diff(contour_data.TextList));
7171
else
72-
zstart = contour_data.LevelList(1) - 1e-3;
73-
zend = contour_data.LevelList(end) + 1e-3;
72+
zstart = contour_data.TextList(1) - 1e-3;
73+
zend = contour_data.TextList(end) + 1e-3;
7474
zsize = 2e-3;
7575
end
7676

@@ -131,13 +131,13 @@
131131
else
132132

133133
%-define as default-%
134-
xey = min(xdata(:)); if xey>0 xfac = -0.2; else xfac = 0.2; end
135-
yey = min(ydata(:)); if yey>0 yfac = -0.2; else yfac = 0.2; end
136-
if zar>0 zfac = -0.15; else zfac = 0.15; end
137-
138-
obj.layout.scene.camera.eye.x = xey + xfac*xey;
134+
xey = - xar; if xey>0 xfac = -0.2; else xfac = 0.2; end
135+
yey = - yar; if yey>0 yfac = -0.2; else yfac = 0.2; end
136+
if zar>0 zfac = 0.2; else zfac = -0.2; end
137+
138+
obj.layout.scene.camera.eye.x = xey + xfac*xey;
139139
obj.layout.scene.camera.eye.y = yey + yfac*yey;
140-
obj.layout.scene.camera.eye.z = zar + yfac*zar;
140+
obj.layout.scene.camera.eye.z = zar + zfac*zar;
141141
end
142142

143143
%---------------------------------------------------------------------%

Diff for: plotly/plotlyfig_aux/handlegraphics/updateContourgroup.m

+7-7
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@
143143
%---------------------------------------------------------------------%
144144

145145
%-colorscale-%
146-
colormap = figure_data.Colormap;
146+
colormap = axis_data.Colormap;
147147

148148
for c = 1:size((colormap),1)
149149
col = 255*(colormap(c,:));
@@ -166,12 +166,12 @@
166166

167167
%-contour levels-%
168168
if length(contour_data.LevelList) > 1
169-
cstart = contour_data.LevelList(1);
170-
cend = contour_data.LevelList(end);
171-
csize = mean(diff(contour_data.LevelList));
169+
cstart = contour_data.TextList(1);
170+
cend = contour_data.TextList(end);
171+
csize = mean(diff(contour_data.TextList));
172172
else
173-
cstart = contour_data.LevelList(1) - 1e-3;
174-
cend = contour_data.LevelList(end) + 1e-3;
173+
cstart = contour_data.TextList(1) - 1e-3;
174+
cend = contour_data.TextList(end) + 1e-3;
175175
csize = 2e-3;
176176
end
177177

@@ -239,7 +239,7 @@
239239
%-------------------------------------------------------------------------%
240240

241241
%-contour showscale-%
242-
obj.data{contourIndex}.showscale = false;
242+
obj.data{contourIndex}.showscale = true;
243243

244244
%-------------------------------------------------------------------------%
245245

Diff for: plotly/plotlyfig_aux/handlegraphics/updateFunctionContour.m

+30-3
Original file line numberDiff line numberDiff line change
@@ -133,14 +133,27 @@
133133
obj.data{contourIndex}.contours.coloring = 'fill';
134134
end
135135

136+
%-------------------------------------------------------------------------%
137+
138+
%-contour levels-%
139+
if length(contour_data.LevelList) > 1
140+
cstart = contour_data.LevelList(1);
141+
cend = contour_data.LevelList(end);
142+
csize = mean(diff(contour_data.LevelList));
143+
else
144+
cstart = contour_data.LevelList(1) - 1e-3;
145+
cend = contour_data.LevelList(end) + 1e-3;
146+
csize = 2e-3;
147+
end
148+
136149
%-start-%
137-
obj.data{contourIndex}.contours.start = contour_data.LevelList(1);
150+
obj.data{contourIndex}.contours.start = cstart;
138151

139152
%-end-%
140-
obj.data{contourIndex}.contours.end = contour_data.LevelList(end);
153+
obj.data{contourIndex}.contours.end = cend;
141154

142155
%-step-%
143-
obj.data{contourIndex}.contours.size = contour_data.LevelStep;
156+
obj.data{contourIndex}.contours.size = csize;
144157

145158
%-------------------------------------------------------------------------%
146159

@@ -199,4 +212,18 @@
199212

200213
%-------------------------------------------------------------------------%
201214

215+
%-axis layout-%
216+
t = 'linear';
217+
eval(['obj.layout.xaxis' num2str(xsource) '.type=t;']);
218+
eval(['obj.layout.xaxis' num2str(xsource) '.autorange=true;']);
219+
eval(['obj.layout.xaxis' num2str(xsource) '.ticktext=axis_data.XTickLabel;']);
220+
eval(['obj.layout.xaxis' num2str(xsource) '.tickvals=axis_data.XTick;']);
221+
222+
eval(['obj.layout.yaxis' num2str(xsource) '.type=t;']);
223+
eval(['obj.layout.yaxis' num2str(xsource) '.autorange=true;']);
224+
eval(['obj.layout.yaxis' num2str(xsource) '.ticktext=axis_data.YTickLabel;']);
225+
eval(['obj.layout.yaxis' num2str(xsource) '.tickvals=axis_data.YTick;']);
226+
227+
%-------------------------------------------------------------------------%
228+
202229
end

Diff for: plotly/plotlyfig_aux/helpers/extractAxisData.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@
223223
%-range (overwrite)-%
224224
axis.autorange = true;
225225
%-axis autotick-%
226-
axis.autotick = true;
226+
% axis.autotick = true;
227227
end
228228
end
229229
end

Diff for: plotly/plotlyfig_aux/helpers/handleFileName.m

+5
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ function handleFileName(obj)
77
str = get(obj.State.Text(t).Handle,'String');
88
interp = get(obj.State.Text(t).Handle,'Interpreter');
99
obj.PlotOptions.FileName = parseString(str,interp);
10+
11+
% untitle.html if \text exist (special chars)
12+
if ~isempty(strfind(obj.PlotOptions.FileName, '\text'))
13+
obj.PlotOptions.FileName = 'untitled';
14+
end
1015
end
1116
end
1217
end

0 commit comments

Comments
 (0)