MATLAB: Plotting a patch hides all scatter data in figure

"hiddenfiguremarkersizeMATLABpatchplotcuberenderingscattersize;

I am trying to plot cubes (really just groups of patches using the function found here: https://www.mathworks.com/matlabcentral/fileexchange/15161-plotcube ) as well as 3D scatter data on the same plot. However, every time a patch is rendered on the figure, it hides all scatter data. I have tried reordering the creation of the objects in order to have the scatter data be shown, forcing the scatter data to the top using uistack(scatterObj,'top'), and messing with the rendering options to no avail.
The following code is a simplified version of what I am trying to do in the end, but it demonstrates the issue. My questions are:
Is there some property of patches that I have not yet found that causes this behavior?
Is there a better way of rendering these rectangles?
Is there some inherent issue with the way that I am trying to acheive this functionality?
% scatterData =
%

% X: [1x4096 double]
% Y: [1x4096 double]
% Z: [1x4096 double]
% C: [1x4096 double]
%
% cubeData =
%
% Edges: [8.6500 1.5900 2.3200]
% Origin: [4.7000 -18.7500 0]
% Alpha: 0.1000
% Colors: [0.0596 0.6596 0.1734]
close all
figure()
scatterObj = scatter3(scatterData.X,scatterData.Y,scatterData.Z,0.5,scatterData.C)
hold on
plotcube(cubeData.Edges,cubeData.Origin,cubeData.Alpha,cubeData.Colors)
xlim([-50 50])
ylim([-50 50])
zlim([-10 10])

Best Answer

Works for me (see below). The marker size in your question is quite small (0.5) but with 4096 points, you should see something. The markesize below is 30, for comparison. Unlike other markers, scatter dot size units are points-squared. The size property is an area of points.
Have you tried restarting matlab? Have you tried setting the alpha value in plotcube() to 1.0 so that there is no transparency? If the probelm persist, what is the value of info = rendererinfo(gca) where gca is the handle to your axes?
figure()
scatterObj = scatter3(rand(1,30),rand(1,30),rand(1,30),50,rand(30,3),'MarkerFaceColor', 'flat')
hold on
plotcube([.5 .5 .5],[.2 .2 .2],0.1,[0 0 1])