From 0eb86ae886c3434158b576ea1be20d163bebaea6 Mon Sep 17 00:00:00 2001 From: Gilberto Galvis Date: Thu, 5 Aug 2021 18:58:16 -0400 Subject: [PATCH 1/2] fix issue #260: surface --- .../handlegraphics/updateSurfaceplot.m | 37 ++++++++++++++----- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/plotly/plotlyfig_aux/handlegraphics/updateSurfaceplot.m b/plotly/plotlyfig_aux/handlegraphics/updateSurfaceplot.m index 02543c7e..de878305 100644 --- a/plotly/plotlyfig_aux/handlegraphics/updateSurfaceplot.m +++ b/plotly/plotlyfig_aux/handlegraphics/updateSurfaceplot.m @@ -9,6 +9,7 @@ %-SURFACE DATA STRUCTURE- % image_data = get(obj.State.Plot(surfaceIndex).Handle); figure_data = get(obj.State.Figure.Handle); + %-AXIS DATA-% eval(['xaxis = obj.layout.xaxis' num2str(xsource) ';']); eval(['yaxis = obj.layout.yaxis' num2str(ysource) ';']); @@ -35,7 +36,7 @@ %-surface x-% obj.data{surfaceIndex}.x = image_data.XData; - + %---------------------------------------------------------------------% %-surface y-% @@ -46,6 +47,28 @@ %-surface z-% obj.data{surfaceIndex}.z = image_data.ZData; + %---------------------------------------------------------------------% + + %- setting grid mesh by default -% + % x-direction + xmin = min(image_data.XData(:)); + xmax = max(image_data.XData(:)); + xsize = (xmax - xmin) / (size(image_data.XData, 2) - 1); + obj.data{surfaceIndex}.contours.x.start = xmin; + obj.data{surfaceIndex}.contours.x.end = xmax; + obj.data{surfaceIndex}.contours.x.size = xsize; + obj.data{surfaceIndex}.contours.x.show = true; + obj.data{surfaceIndex}.contours.x.color = 'black'; + % y-direction + ymin = min(image_data.YData(:)); + ymax = max(image_data.YData(:)); + ysize = (ymax - ymin) / (size(image_data.YData, 2)); + obj.data{surfaceIndex}.contours.y.start = ymin; + obj.data{surfaceIndex}.contours.y.end = ymax; + obj.data{surfaceIndex}.contours.y.size = ysize; + obj.data{surfaceIndex}.contours.y.show = true; + obj.data{surfaceIndex}.contours.y.color = 'black'; + else @@ -61,22 +84,18 @@ %-------------------------------------------------------------------------% - %-image colorscale-% cmap = figure_data.Colormap; +len = length(cmap)-1; for c = 1: length(cmap) - x1=(c-1)/length(cmap); - if x1 > 0.99 - x=round(x1); - else - x=x1; - end - obj.data{surfaceIndex}.colorscale{c} = { x , ['rgb(' num2str(255*cmap(c,1)) ',' num2str(255*cmap(c,2)) ',' num2str(255*cmap(c,3)) ',' ')' ] }; + col = 255 * cmap(c, :); + obj.data{surfaceIndex}.colorscale{c} = { (c-1)/len , ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) ')' ] }; end obj.data{surfaceIndex}.surfacecolor = image_data.CData; + %-------------------------------------------------------------------------% %-surface name-% From 9bf436ee1bf6bce40e799950720f47e5ce1e8afb Mon Sep 17 00:00:00 2001 From: Gilberto Galvis Date: Thu, 5 Aug 2021 20:49:00 -0400 Subject: [PATCH 2/2] fix issue #302 --- plotly/plotlyfig_aux/handlegraphics/updateLineseries.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plotly/plotlyfig_aux/handlegraphics/updateLineseries.m b/plotly/plotlyfig_aux/handlegraphics/updateLineseries.m index 51986b60..cdd0d324 100644 --- a/plotly/plotlyfig_aux/handlegraphics/updateLineseries.m +++ b/plotly/plotlyfig_aux/handlegraphics/updateLineseries.m @@ -74,8 +74,8 @@ function updateLineseries(obj,plotIndex) ispolar = true; end -%-if polar ezplot or not-% -if abs(x(1)-x(end))<1e-5 && abs(y(1)-y(end))<1e-5 +%-if ezpolar or not-% +if length(obj.State.Axis(plotIndex).Handle.Children) == 2 ispolar = true; end