Skip to content

Commit 8813265

Browse files
Merge pull request #337 from plotly/issue253_fixed_quiver
Issue253 fixed quiver
2 parents 6bb2c5f + 39cdacc commit 8813265

File tree

8 files changed

+848
-96
lines changed

8 files changed

+848
-96
lines changed

plotly/plotlyfig.m

+15
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
obj.PlotOptions.Visible = 'on';
6161
obj.PlotOptions.TriangulatePatch = false;
6262
obj.PlotOptions.StripMargins = false;
63+
obj.PlotOptions.TreatAs = '_';
6364

6465
% offline options
6566
obj.PlotOptions.Offline = true;
@@ -196,6 +197,9 @@
196197
if(strcmpi(varargin{a},'StripMargins'))
197198
obj.PlotOptions.StripMargins = varargin{a+1};
198199
end
200+
if(strcmpi(varargin{a},'TreatAs'))
201+
obj.PlotOptions.TreatAs = varargin{a+1};
202+
end
199203
end
200204
end
201205

@@ -538,6 +542,16 @@ function validate(obj)
538542
% find plots of figure
539543
plots = findobj(ax(axrev),'-not','Type','Text','-not','Type','axes','-depth',1);
540544

545+
% get number of nbars for pie3
546+
if strcmpi(obj.PlotOptions.TreatAs, 'pie3')
547+
obj.PlotOptions.nbars = 0;
548+
for i = 1:length(plots)
549+
if strcmpi(getGraphClass(plots(i)), 'surface')
550+
obj.PlotOptions.nbars = obj.PlotOptions.nbars + 1;
551+
end
552+
end
553+
end
554+
541555
% add baseline objects
542556
baselines = findobj(ax(axrev),'-property','BaseLine');
543557

@@ -955,6 +969,7 @@ function delete(obj)
955969
strcmpi(fieldname,'surface') || strcmpi(fieldname,'scatter3d') ...
956970
|| strcmpi(fieldname,'mesh3d') || strcmpi(fieldname,'bar') ...
957971
|| strcmpi(fieldname,'scatterpolar') || strcmpi(fieldname,'barpolar') ...
972+
|| strcmpi(fieldname,'scene') ...
958973
)
959974
fprintf(['\nWhoops! ' exception.message(1:end-1) ' in ' fieldname '\n\n']);
960975
end

plotly/plotlyfig_aux/core/updateAnnotation.m

+7-3
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,13 @@
9191
%-------------------------------------------------------------------------%
9292

9393
%-text-%
94-
obj.layout.annotations{anIndex}.text = parseString(text_data.String,text_data.Interpreter);
95-
if obj.State.Text(anIndex).Title && isempty(text_data.String)
96-
obj.layout.annotations{anIndex}.text = '<b></b>'; %empty string annotation
94+
if ~strcmpi(obj.PlotOptions.TreatAs, 'pie3')
95+
obj.layout.annotations{anIndex}.text = parseString(text_data.String,text_data.Interpreter);
96+
if obj.State.Text(anIndex).Title && isempty(text_data.String)
97+
obj.layout.annotations{anIndex}.text = '<b></b>'; %empty string annotation
98+
end
99+
else
100+
obj.layout.annotations{anIndex}.text = '<b></b>';
97101
end
98102

99103
%-------------------------------------------------------------------------%

plotly/plotlyfig_aux/core/updateData.m

+97-81
Original file line numberDiff line numberDiff line change
@@ -2,89 +2,105 @@
22

33
function obj = updateData(obj, dataIndex)
44

5-
%-update plot based on plot call class-%
65
try
7-
switch lower(obj.State.Plot(dataIndex).Class)
6+
7+
%-update plot based on TreatAs PlotOpts-%
8+
9+
if ~strcmpi(obj.PlotOptions.TreatAs, '_')
10+
if strcmpi(obj.PlotOptions.TreatAs, 'pie3')
11+
updatePie3(obj, dataIndex);
12+
end
13+
14+
%-update plot based on plot call class-%
15+
16+
else
817

9-
%--CORE PLOT OBJECTS--%
10-
case 'image'
11-
updateImage(obj, dataIndex);
12-
case 'line'
13-
updateLineseries(obj, dataIndex);
14-
case 'categoricalhistogram'
15-
updateCategoricalHistogram(obj, dataIndex);
16-
case 'histogram'
17-
if strcmpi(obj.State.Axis(dataIndex).Handle.Type, 'polaraxes')
18-
updateHistogramPolar(obj, dataIndex);
19-
else
20-
updateHistogram(obj, dataIndex);
21-
end
22-
case 'histogram2'
23-
updateHistogram2(obj, dataIndex);
24-
case 'patch'
25-
% check for histogram
26-
if isHistogram(obj,dataIndex)
27-
updateHistogram(obj,dataIndex);
28-
else
29-
updatePatch(obj, dataIndex);
30-
end
31-
case 'rectangle'
32-
updateRectangle(obj,dataIndex);
33-
case 'surface'
34-
updateSurfaceplot(obj,dataIndex);
35-
case 'functionsurface'
36-
updateFunctionSurface(obj,dataIndex);
37-
38-
%-GROUP PLOT OBJECTS-%
39-
case 'area'
40-
updateArea(obj, dataIndex);
41-
case 'areaseries'
42-
updateAreaseries(obj, dataIndex);
43-
case 'bar'
44-
updateBar(obj, dataIndex);
45-
case 'barseries'
46-
updateBarseries(obj, dataIndex);
47-
case 'baseline'
48-
updateBaseline(obj, dataIndex);
49-
case {'contourgroup','contour'}
50-
updateContourgroup(obj,dataIndex);
51-
case 'errorbar'
52-
updateErrorbar(obj,dataIndex);
53-
case 'errorbarseries'
54-
updateErrorbarseries(obj,dataIndex);
55-
case 'lineseries'
56-
updateLineseries(obj, dataIndex);
57-
case 'quiver'
58-
updateQuiver(obj, dataIndex);
59-
case 'quivergroup'
60-
updateQuivergroup(obj, dataIndex);
61-
case 'scatter'
62-
if strcmpi(obj.State.Axis(dataIndex).Handle.Type, 'polaraxes')
63-
updateScatterPolar(obj, dataIndex);
64-
else
65-
updateScatter(obj, dataIndex);
66-
end
67-
case 'scattergroup'
68-
updateScattergroup(obj, dataIndex);
69-
case 'stair'
70-
updateStair(obj, dataIndex);
71-
case 'stairseries'
72-
updateStairseries(obj, dataIndex);
73-
case 'stem'
74-
updateStem(obj, dataIndex);
75-
case 'stemseries'
76-
updateStemseries(obj, dataIndex);
77-
case 'surfaceplot'
78-
updateSurfaceplot(obj,dataIndex);
79-
case 'implicitfunctionline'
80-
updateLineseries(obj, dataIndex);
81-
82-
%--Plotly supported MATLAB group plot objects--%
83-
case {'hggroup','group'}
84-
% check for boxplot
85-
if isBoxplot(obj, dataIndex)
86-
updateBoxplot(obj, dataIndex);
87-
end
18+
switch lower(obj.State.Plot(dataIndex).Class)
19+
20+
%--CORE PLOT OBJECTS--%
21+
case 'image'
22+
updateImage(obj, dataIndex);
23+
case 'line'
24+
updateLineseries(obj, dataIndex);
25+
case 'categoricalhistogram'
26+
updateCategoricalHistogram(obj, dataIndex);
27+
case 'histogram'
28+
if strcmpi(obj.State.Axis(dataIndex).Handle.Type, 'polaraxes')
29+
updateHistogramPolar(obj, dataIndex);
30+
else
31+
updateHistogram(obj, dataIndex);
32+
end
33+
case 'histogram2'
34+
updateHistogram2(obj, dataIndex);
35+
case 'patch'
36+
% check for histogram
37+
if isHistogram(obj,dataIndex)
38+
updateHistogram(obj,dataIndex);
39+
else
40+
updatePatch(obj, dataIndex);
41+
end
42+
case 'rectangle'
43+
updateRectangle(obj,dataIndex);
44+
case 'surface'
45+
updateSurfaceplot(obj,dataIndex);
46+
case 'functionsurface'
47+
updateFunctionSurface(obj,dataIndex);
48+
case 'implicitfunctionsurface'
49+
updateImplicitFunctionSurface(obj,dataIndex);
50+
51+
%-GROUP PLOT OBJECTS-%
52+
case 'area'
53+
updateArea(obj, dataIndex);
54+
case 'areaseries'
55+
updateAreaseries(obj, dataIndex);
56+
case 'bar'
57+
updateBar(obj, dataIndex);
58+
case 'barseries'
59+
updateBarseries(obj, dataIndex);
60+
case 'baseline'
61+
updateBaseline(obj, dataIndex);
62+
case {'contourgroup','contour'}
63+
updateContourgroup(obj,dataIndex);
64+
case 'functioncontour'
65+
updateFunctionContour(obj,dataIndex);
66+
case 'errorbar'
67+
updateErrorbar(obj,dataIndex);
68+
case 'errorbarseries'
69+
updateErrorbarseries(obj,dataIndex);
70+
case 'lineseries'
71+
updateLineseries(obj, dataIndex);
72+
case 'quiver'
73+
updateQuiver(obj, dataIndex);
74+
case 'quivergroup'
75+
updateQuivergroup(obj, dataIndex);
76+
case 'scatter'
77+
if strcmpi(obj.State.Axis(dataIndex).Handle.Type, 'polaraxes')
78+
updateScatterPolar(obj, dataIndex);
79+
else
80+
updateScatter(obj, dataIndex);
81+
end
82+
case 'scattergroup'
83+
updateScattergroup(obj, dataIndex);
84+
case 'stair'
85+
updateStair(obj, dataIndex);
86+
case 'stairseries'
87+
updateStairseries(obj, dataIndex);
88+
case 'stem'
89+
updateStem(obj, dataIndex);
90+
case 'stemseries'
91+
updateStemseries(obj, dataIndex);
92+
case 'surfaceplot'
93+
updateSurfaceplot(obj,dataIndex);
94+
case 'implicitfunctionline'
95+
updateLineseries(obj, dataIndex);
96+
97+
%--Plotly supported MATLAB group plot objects--%
98+
case {'hggroup','group'}
99+
% check for boxplot
100+
if isBoxplot(obj, dataIndex)
101+
updateBoxplot(obj, dataIndex);
102+
end
103+
end
88104
end
89105

90106
catch exception

0 commit comments

Comments
 (0)