diff --git a/plotly/plotlyfig.m b/plotly/plotlyfig.m index 240a7db1..72abeaa5 100644 --- a/plotly/plotlyfig.m +++ b/plotly/plotlyfig.m @@ -671,9 +671,8 @@ function validate(obj) updateData(obj,n); try - if (strcmp(obj.data{n}.type, 'bar') && update_opac(length(ax)-n)) - obj.data{1, n}.opacity = 0.9; - obj.data{1, n}.marker.color = 'rgb(0,113.985,188.955)'; + if update_opac(length(ax)-n) + % obj.data{1, n}.opacity = 0.9; end catch % TODO to the future diff --git a/plotly/plotlyfig_aux/core/updateData.m b/plotly/plotlyfig_aux/core/updateData.m index bcb87fb6..1d0c8327 100644 --- a/plotly/plotlyfig_aux/core/updateData.m +++ b/plotly/plotlyfig_aux/core/updateData.m @@ -15,6 +15,10 @@ updatePolarplot(obj, dataIndex); elseif strcmpi(obj.PlotOptions.TreatAs, 'contour3') updateContour3(obj, dataIndex); + elseif strcmpi(obj.PlotOptions.TreatAs, 'compass') + updateLineseries(obj, dataIndex); + elseif strcmpi(obj.PlotOptions.TreatAs, 'ezpolar') + updateLineseries(obj, dataIndex); end %-update plot based on plot call class-% diff --git a/plotly/plotlyfig_aux/handlegraphics/updateHistogram2.m b/plotly/plotlyfig_aux/handlegraphics/updateHistogram2.m index 79b9ecee..995d187c 100644 --- a/plotly/plotlyfig_aux/handlegraphics/updateHistogram2.m +++ b/plotly/plotlyfig_aux/handlegraphics/updateHistogram2.m @@ -1,52 +1,141 @@ function obj = updateHistogram2(obj,histIndex) +%---------------------------------------------------------------------% + %-AXIS INDEX-% axIndex = obj.getAxisIndex(obj.State.Plot(histIndex).AssociatedAxis); +%---------------------------------------------------------------------% + %-HIST DATA STRUCTURE- % hist_data = get(obj.State.Plot(histIndex).Handle); +%---------------------------------------------------------------------% + %-hist type-% obj.data{histIndex}.type = 'mesh3d'; +%---------------------------------------------------------------------% + %-required parameters-% values = hist_data.Values; -xedges = hist_data.XBinEdges; +xedges = hist_data.XBinEdges; yedges = hist_data.YBinEdges; +sx = diff(xedges(2:end-1)); +sy = diff(yedges(2:end-1)); + +if isinf(xedges(1)) xedges(1) = xedges(2) - sx(1); end +if isinf(yedges(1)) yedges(1) = yedges(2) - sy(1); end + +if isinf(xedges(end)) xedges(end) = xedges(end-1) + sx(1); end +if isinf(yedges(end)) yedges(end) = yedges(end-1) + sy(1); end + +%---------------------------------------------------------------------% + %-get the values to use plotly's mesh3D-% -bargap = 0.06; +bargap = 0.05; [X, Y, Z, I, J, K] = get_plotly_mesh3d(xedges, yedges, values, bargap); +%---------------------------------------------------------------------% + %-passing parameters to mesh3D-% obj.data{histIndex}.x = X; obj.data{histIndex}.y = Y; obj.data{histIndex}.z = Z; -obj.data{histIndex}.i = uint16(I-1); -obj.data{histIndex}.j = uint16(J-1); -obj.data{histIndex}.k = uint16(K-1); +obj.data{histIndex}.i = int16(I-1); +obj.data{histIndex}.j = int16(J-1); +obj.data{histIndex}.k = int16(K-1); + +%---------------------------------------------------------------------% %-some settings-% -obj.data{histIndex}.color=[0.8,0.8,0.8]; +% obj.data{histIndex}.color='rgb(0,255,0)'; obj.data{histIndex}.contour.show = true; -obj.data{histIndex}.contour.color = 'black'; obj.data{histIndex}.contour.width = 6; +obj.data{histIndex}.contour.color='rgb(0,0,0)'; obj.data{histIndex}.flatshading = true; -obj.data{histIndex}.bordercolor = 'black'; -obj.data{histIndex}.borderwidth = 6; + +%---------------------------------------------------------------------% + +%-lighting settings-% +obj.data{histIndex}.lighting.diffuse = 0.92; +obj.data{histIndex}.lighting.ambient = 0.54; +obj.data{histIndex}.lighting.specular = 1.42; +obj.data{histIndex}.lighting.roughness = 0.52; +obj.data{histIndex}.lighting.fresnel = 0.2; +obj.data{histIndex}.lighting.vertexnormalsepsilon = 1e-12; +obj.data{histIndex}.lighting.facenormalsepsilon = 1e-6; + +%---------------------------------------------------------------------% + +%-aspect ratio-% +ar = obj.PlotOptions.AspectRatio; + +if ~isempty(ar) + if ischar(ar) + obj.layout.scene.aspectmode = ar; + elseif isvector(ar) && length(ar) == 3 + xar = ar(1); + yar = ar(2); + zar = ar(3); + end +else + + %-define as default-% + xar = max(xedges(:)); + yar = max(yedges(:)); + zar = 0.7*max([xar, yar]); +end + +obj.layout.scene.aspectratio.x = xar; +obj.layout.scene.aspectratio.y = yar; +obj.layout.scene.aspectratio.z = zar; + +%---------------------------------------------------------------------% + +%-camera eye-% +ey = obj.PlotOptions.CameraEye; + +if ~isempty(ey) + if isvector(ey) && length(ey) == 3 + obj.layout.scene.camera.eye.x = ey(1); + obj.layout.scene.camera.eye.y = ey(2); + obj.layout.scene.camera.eye.z = ey(3); + end +else + + %-define as default-% + xey = - xar; if xey>0 xfac = -0.2; else xfac = 0.2; end + yey = - yar; if yey>0 yfac = -0.2; else yfac = 0.2; end + if zar>0 zfac = 0.2; else zfac = -0.2; end + + obj.layout.scene.camera.eye.x = xey + xfac*xey; + obj.layout.scene.camera.eye.y = yey + yfac*yey; + obj.layout.scene.camera.eye.z = zar + zfac*zar; +end + +%---------------------------------------------------------------------% + + +%-zerolines hidded-% +obj.layout.scene.xaxis.zeroline = false; +obj.layout.scene.yaxis.zeroline = false; +obj.layout.scene.zaxis.zeroline = false; + +%---------------------------------------------------------------------% %-layout bargap-% obj.layout.bargap = bargap; -%-layout barmode-% -obj.layout.barmode = 'group'; - %-hist name-% obj.data{histIndex}.name = hist_data.DisplayName; %-hist visible-% obj.data{histIndex}.visible = strcmp(hist_data.Visible,'on'); +%---------------------------------------------------------------------% + end @@ -131,9 +220,9 @@ ze = zeros(size(xe)); positions = zeros([size(xe), 3]); - positions(:,:,1) = ye'; - positions(:,:,2) = xe'; - positions(:,:,3) = ze'; + positions(:,:,1) = xe; + positions(:,:,2) = ye; + positions(:,:,3) = ze; [m, n, p] = size(positions); positions = reshape(positions, [m*n, p]); diff --git a/plotly/plotlyfig_aux/handlegraphics/updateLineseries.m b/plotly/plotlyfig_aux/handlegraphics/updateLineseries.m index 28b35352..2e6728b2 100644 --- a/plotly/plotlyfig_aux/handlegraphics/updateLineseries.m +++ b/plotly/plotlyfig_aux/handlegraphics/updateLineseries.m @@ -66,23 +66,14 @@ function updateLineseries(obj,plotIndex) %-------------------------------------------------------------------------% %-if polar plot or not-% -ispolar = false; -x = plot_data.XData; -y = plot_data.YData; +treatas = obj.PlotOptions.TreatAs; +ispolar = strcmpi(treatas, 'compass') || strcmpi(treatas, 'ezpolar'); -if length(x)==5 && length(y)==5 && x(2)==x(4) && y(2)==y(4) - ispolar = true; -end +%-------------------------------------------------------------------------% -%-if ezpolar or not-% -len = length(obj.State.Axis.Handle.Children); -if len > 1 - for l = 1:len - if strcmpi(obj.State.Axis.Handle.Children(l).Type, 'Text') - ispolar = true; - end - end -end +%-getting data-% +x = plot_data.XData; +y = plot_data.YData; %-------------------------------------------------------------------------% diff --git a/plotly/plotlyfig_aux/helpers/extractLineMarker.m b/plotly/plotlyfig_aux/helpers/extractLineMarker.m index 41eb2542..3733a034 100644 --- a/plotly/plotlyfig_aux/helpers/extractLineMarker.m +++ b/plotly/plotlyfig_aux/helpers/extractLineMarker.m @@ -28,8 +28,10 @@ switch line_data.Marker case '.' marksymbol = 'circle'; + marker.size = 0.4*line_data.MarkerSize; case 'o' marksymbol = 'circle'; + marker.size = 0.4*line_data.MarkerSize; case 'x' marksymbol = 'x-thin-open'; case '+' diff --git a/plotly/plotlyfig_aux/helpers/extractPatchFace.m b/plotly/plotlyfig_aux/helpers/extractPatchFace.m index 08282fc1..57a9f695 100644 --- a/plotly/plotlyfig_aux/helpers/extractPatchFace.m +++ b/plotly/plotlyfig_aux/helpers/extractPatchFace.m @@ -50,6 +50,9 @@ end marker.color = ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) ')']; + + case 'auto' + marker.color = 'rgb(0,113.985,188.955)'; end end @@ -57,7 +60,6 @@ %-------------------------------------------------------------------------% %-PATCH EDGE COLOR-% - if isnumeric(patch_data.EdgeColor) col = 255*patch_data.EdgeColor;