How to create a color plot based on the number of occurance?

조회 수: 4 (최근 30일)
Ashfaq Ahmed
Ashfaq Ahmed 2023년 4월 28일
답변: Hyunuk Ha 2023년 4월 29일
Hi! I have a polar plot and we can see most of the data points fall within the 0° and 180° line. And the rest of the points are uniformly scattered. I want to plot a color graph that changes the color with the number of occurance in that region. For example, intense red color in the 0° and 180° line and white color where there is less data point.
The r and theta values are attache din this question. Any feedback will be greatly aprpeciated!!

채택된 답변

Hyunuk Ha
Hyunuk Ha 2023년 4월 29일
The most easiest way is : use your r data as color map.
I made simple example as :
load('theta.mat');
load('r.mat');
polardata = [r, theta];
polardata = rmmissing(polardata);
figure; polarscatter(polardata(:,1),polardata(:,2), [], polardata(:,2));
colormap(gca,'parula') % Change colormap as you want.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Distribution Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by