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

조회 수: 4 (최근 30일)
Jan Jaap van Assen
Jan Jaap van Assen 2022년 10월 21일
편집: Jan Jaap van Assen 2022년 10월 21일
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에서 Polar Plots에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by