Skip to content

Commit 6e93435

Browse files
Add support for single point line plots
1 parent 4d07882 commit 6e93435

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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

+5-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ function updateLineseries(obj, plotIndex)
5151
obj.data{plotIndex}.type = 'scatterpolar';
5252
updateDefaultPolaraxes(obj, plotIndex)
5353
obj.data{plotIndex}.subplot = sprintf('polar%d', xSource+1);
54-
5554
elseif ~isPlot3D
5655
obj.data{plotIndex}.type = 'scatter';
5756
obj.data{plotIndex}.xaxis = sprintf('x%d', xSource);
@@ -73,11 +72,15 @@ function updateLineseries(obj, plotIndex)
7372
if isPolar
7473
obj.data{plotIndex}.r = rData;
7574
obj.data{plotIndex}.theta = thetaData;
76-
7775
else
7876
obj.data{plotIndex}.x = xData;
7977
obj.data{plotIndex}.y = yData;
8078

79+
if isscalar(xData) % plotly has trouble plotting a single point
80+
obj.data{plotIndex}.x = repmat(obj.data{plotIndex}.x,[1,2]);
81+
obj.data{plotIndex}.y = repmat(obj.data{plotIndex}.y,[1,2]);
82+
end
83+
8184
if isPlot3D
8285
obj.data{plotIndex}.z = zData;
8386
obj.PlotOptions.is3d = true;

0 commit comments

Comments
 (0)