Hi Samuel,
I understand you're looking to visualize the distribution of several large 2D point sets grouped by category, and that functions like 'gscatter' cause occlusion issues when plotting large data.
While 'binscatter' does not directly support grouping, you can still visualize multiple groups by plotting each group separately using a loop and overlaying the results. To avoid overplotting, you can apply a transparency filter using the 'FaceAlpha' property.
For compatibility with older MATLAB versions, you can avoid using properties like 'FaceColor' or 'XBinCount' which may not be supported. Instead, you can utilize the following parameters:
- Using 'NumBins' to set the bin resolution.
- Overlaying each group’s 'binscatter' output in a loop.
- Using transparency to reduce visual clutter.
Here is how you can achieve the same in MATLAB:
figure;
hold on;
for i = 1:numGroups
idx = groupLabels == i;
h = binscatter(x(idx), y(idx), 'NumBins', [50 50]);
h.FaceAlpha = 0.4; % Add transparency to prevent occlusion
end
hold off;
xlabel('X');
ylabel('Y');
title('Grouped Bin Scatter Plot');
This approach should allow you to visualize multiple large datasets simultaneously without losing important distribution details.
For more information regarding usage of 'binscatter' function for plotting binned scatter plots, you can refer to the following documentation link:
Best!
