Hide/remove bubbles of size = 0 in polarbubblechart

5 views (last 30 days)
Hi,
I am using the function polarbubblechart to plot 7 datasets, each with 14 points. My rho is the same for all of them and each theta is linearly associated to a size. The size is a count of the ocurrance of that rho. To plot, I am using this line:
polarbubblechart(tbl,{'a','b', 'c', 'd','e','f','g'},'rank', {'countA','countB','countC','countD','countE','countF','countG'});
My issue is when I have size = 0. Attached is a photo of the graph plotted when I run my code. You can see that there are several points where size = 0 being plotted and I would like to remove or hide them. I thought that because size = 0, it wouldn't show up on my graph but it is. I have tried some things already but nothing seems to work, such as:
  • trying to change the color to white of those points. Each dataset should have a different color and in each dataset there could be zeros. What I did here was create an array of arrays with the color I want and then iterate through the 'countLetter' variable to check if it's a zero and change it to white. I may have done something wrong or misunderstood the documentation but it wouldn't let me change individual points within the datasets
  • trying to change the transparance of those points. Differently from the above, I could only pass a scalar here, so all the points would have the same opacity.
  • brushing the plot. I am familiar with brushing but it doesn't seem to work with polarbubbluechart. Is that the case?
Does anyone have other suggestions? I really cannot have the size = 0 points in my graph... Thanks!

Accepted Answer

dpb
dpb on 25 Jul 2022
tbl.countA(tbl.CountA==0)=nan;
tbl.countB(tbl.CountB==0)=nan;
...
tbl.countG(tbl.CountG==0)=nan;
polarbubblechart(tbl,{'a','b', 'c', 'd','e','f','g'},'rank', ...
{'countA','countB','countC','countD','countE','countF','countG'});
There's bound to be a neater way to write the various variable names succinctly to act on the group or implied loop, but the above gets the job done in brute force fashion. Plotting functions do not display non-finite values -- zero is still considered a valid value as you've discovered.
Whether the size being identically zero and still showing should be considered a bug/quality of implementation issue I'll leave for others to decide -- I can see at least some arguments why it might be considered either way.
  3 Comments
dpb
dpb on 25 Jul 2022
Is a very useful and often-needed trick with graphics to create desired effects...
dpb
dpb on 25 Jul 2022
vn=find(startsWith(tbl.Properties.VariableNames,'count')); % the count variables
tmp=tbl{:,vn}; % the counts array
tmp(tmp==0)=nan; % the substitution
tbl{:,vn}=tmp; % put back into table
is one way...

Sign in to comment.

More Answers (0)

Categories

Find more on Data Distribution 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!