In need of combination of polarscatter() and scatterhist()

7 次查看(过去 30 天)
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:
  1. Tweak placement and spacing of subplots
  2. 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 个)

类别

Help CenterFile Exchange 中查找有关 Graphics 的更多信息

产品


版本

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by