In need of combination of polarscatter() and scatterhist()
4 views (last 30 days)
Show older comments
Hello everyone,
I’m trying to make a polarscatter plot where histograms on the x and y axis show the local density as there are many datapoints (~32 million). Polarscatter() works perfectly but has no option to add the histograms. Scatterhist() seems to do exactly what I need but doesn’t seem to work for polar plots. I’m now working with subplots but alignment is a complete mess. How would you solve this? I think of two options:
- Tweak placement and spacing of subplots
- Use scatterhist() and make it work with polar coordinates.
Any suggestions are really appreciated. I’m using Matlab 2020a.
Here is the current code:
figure
subplot(2,2,1)
polarscatter(angle,radius,sz,color,'.')
rlim([0 maxrad])
pax = gca;
pax.ThetaTickLabel = string(pax.ThetaTickLabel) + char(176); % add degree sign
hold on
sz = 25;
polarscatter(mean(angle),mean(radius),sz,'k','+')
hold off
subplot(2,2,2)
area(x,binV)
xlim([-maxrad maxrad])
ylim([0 yMax])
camroll(-90)
pbaspect([3 1 1])
set(gca,'YTickLabel',[]);
subplot(2,2,3)
area(x,binU)
xlim([-maxrad maxrad])
ylim([0 yMax])
set(gca,'YDir','reverse');
pbaspect([3 1 1])
set(gca,'YTickLabel',[]);
Here is the output plot:
0 Comments
Answers (0)
See Also
Categories
Find more on Polar Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!