Skip to content

Issue253 fixed quiver #337

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Aug 13, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix issue #248
  • Loading branch information
galvisgilberto committed Aug 13, 2021
commit 06237f74c46d641bc50bacb067fbeb3760e82c8f
2 changes: 2 additions & 0 deletions plotly/plotlyfig_aux/core/updateData.m
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@
updateBaseline(obj, dataIndex);
case {'contourgroup','contour'}
updateContourgroup(obj,dataIndex);
case 'functioncontour'
updateFunctionContour(obj,dataIndex);
case 'errorbar'
updateErrorbar(obj,dataIndex);
case 'errorbarseries'
Expand Down
202 changes: 202 additions & 0 deletions plotly/plotlyfig_aux/handlegraphics/updateFunctionContour.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
function obj = updateFunctionContour(obj,contourIndex)

%-FIGURE DATA STRUCTURE-%
figure_data = get(obj.State.Figure.Handle);

%-AXIS INDEX-%
axIndex = obj.getAxisIndex(obj.State.Plot(contourIndex).AssociatedAxis);

%-AXIS DATA STRUCTURE-%
axis_data = get(obj.State.Plot(contourIndex).AssociatedAxis);

%-PLOT DATA STRUCTURE- %
contour_data = get(obj.State.Plot(contourIndex).Handle);

%-CHECK FOR MULTIPLE AXES-%
[xsource, ysource] = findSourceAxis(obj,axIndex);

%-AXIS DATA-%
eval(['xaxis = obj.layout.xaxis' num2str(xsource) ';']);
eval(['yaxis = obj.layout.yaxis' num2str(ysource) ';']);

%-------------------------------------------------------------------------%

%-contour xaxis-%
obj.data{contourIndex}.xaxis = ['x' num2str(xsource)];

%-------------------------------------------------------------------------%

%-contour yaxis-%
obj.data{contourIndex}.yaxis = ['y' num2str(ysource)];

%-------------------------------------------------------------------------%

%-contour name-%
obj.data{contourIndex}.name = contour_data.DisplayName;

%-------------------------------------------------------------------------%

%-contour type-%
obj.data{contourIndex}.type = 'contour';

%-------------------------------------------------------------------------%

%-setting the plot-%
xdata = contour_data.XData;
ydata = contour_data.YData;
zdata = contour_data.ZData;

%-contour x data-%
if ~isvector(xdata)
obj.data{contourIndex}.x = xdata(1,:);
else
obj.data{contourIndex}.x = xdata;
end

%-contour y data-%
if ~isvector(ydata)
obj.data{contourIndex}.y = ydata(:,1);
else
obj.data{contourIndex}.y = ydata;
end

%-contour z data-%
obj.data{contourIndex}.z = zdata;

%-------------------------------------------------------------------------%

%-contour x type-%

obj.data{contourIndex}.xtype = 'array';

%-------------------------------------------------------------------------%

%-contour y type-%

obj.data{contourIndex}.ytype = 'array';

%-------------------------------------------------------------------------%

%-contour visible-%

obj.data{contourIndex}.visible = strcmp(contour_data.Visible,'on');

%-------------------------------------------------------------------------%

%-contour showscale-%
obj.data{contourIndex}.showscale = false;

%-------------------------------------------------------------------------%

%-zauto-%
obj.data{contourIndex}.zauto = false;

%-------------------------------------------------------------------------%

%-zmin-%
obj.data{contourIndex}.zmin = axis_data.CLim(1);

%-------------------------------------------------------------------------%

%-zmax-%
obj.data{contourIndex}.zmax = axis_data.CLim(2);

%-------------------------------------------------------------------------%

%-colorscale (ASSUMES PATCH CDATAMAP IS 'SCALED')-%
colormap = figure_data.Colormap;

for c = 1:size((colormap),1)
col = 255*(colormap(c,:));
obj.data{contourIndex}.colorscale{c} = {(c-1)/(size(colormap,1)-1), ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) ')']};
end

%-------------------------------------------------------------------------%

%-contour reverse scale-%
obj.data{contourIndex}.reversescale = false;

%-------------------------------------------------------------------------%

%-autocontour-%
obj.data{contourIndex}.autocontour = false;

%-------------------------------------------------------------------------%

%-contour contours-%

%-coloring-%
switch contour_data.Fill
case 'off'
obj.data{contourIndex}.contours.coloring = 'lines';
case 'on'
obj.data{contourIndex}.contours.coloring = 'fill';
end

%-start-%
obj.data{contourIndex}.contours.start = contour_data.LevelList(1);

%-end-%
obj.data{contourIndex}.contours.end = contour_data.LevelList(end);

%-step-%
obj.data{contourIndex}.contours.size = contour_data.LevelStep;

%-------------------------------------------------------------------------%

if(~strcmp(contour_data.LineStyle,'none'))

%-contour line colour-%
if isnumeric(contour_data.LineColor)
col = 255*contour_data.LineColor;
obj.data{contourIndex}.line.color = ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) ')'];
else
obj.data{contourIndex}.line.color = 'rgba(0,0,0,0)';
end

%-contour line width-%
obj.data{contourIndex}.line.width = contour_data.LineWidth;

%-contour line dash-%
switch contour_data.LineStyle
case '-'
LineStyle = 'solid';
case '--'
LineStyle = 'dash';
case ':'
LineStyle = 'dot';
case '-.'
LineStyle = 'dashdot';
end

obj.data{contourIndex}.line.dash = LineStyle;

%-contour smoothing-%
obj.data{contourIndex}.line.smoothing = 0;

else

%-contours showlines-%
obj.data{contourIndex}.contours.showlines = false;

end

%-------------------------------------------------------------------------%

%-contour showlegend-%

leg = get(contour_data.Annotation);
legInfo = get(leg.LegendInformation);

switch legInfo.IconDisplayStyle
case 'on'
showleg = true;
case 'off'
showleg = false;
end

obj.data{contourIndex}.showlegend = showleg;

%-------------------------------------------------------------------------%

end