Filling NaN void in polar plot

Hello Everyone,
I am dealing with a polar plot that is incomplete due to NaN values in the data. Please see figure 'Void polar plot.png'.
If I replace NaNs with zeros then, of course, I get the whole graph but I do not know if zero is the physically right replacement for NaNs in my problem. This is shown in figure 'Nan to 0.png'. I have also attached the variable Vq that I am plotting (NaNs are replaced with zeros).
Would it be possible to have the same (complete) polar plot with NaNs being in grey color and color bar indicating only the range of real data (excluding grey color)?
My code is as follows:
clear
close all
% Set azimuth and radial range
AngRange = deg2rad([0 180]);
RadRange = [0 2];
% Set polar grid spacing in radial direction
RD = 0:0.5:2;
% Axis properties
axprop = {'DataAspectRatio',[1 1 1],'View', [0 90],...
'Xlim', [-2 2],'visible','off'};
% Load data
load('Vq.mat')
% Plot results using Math Works function for polar plot
polarplot3d(Vq,'plottype','surfn','InterpMethod','linear',...
'AngularRange',AngRange,'RadialRange',RadRange,...
'PolarDirection','cw','TickSpacing',15,...
'PolarGrid',{RD,length(RD)+1},'GridStyle',':');
set(gca,axprop{:});
% Add color bar
ColBar = colorbar('Location','west');
Thanks, djr

6 件のコメント

Chad Greene
Chad Greene 2018 年 10 月 17 日
Can you simply set
set(gca,'color',0.5*[1 1 1])
or perhaps underlay with a gray patch?
djr
djr 2018 年 10 月 17 日
Unfortunately it doesn't work. I still get that incomplete graph, but with gray color around it.
Chad Greene
Chad Greene 2018 年 10 月 18 日
What if you draw a gray circle the size of your polar graph, then plot the polar graph on top of it?
djr
djr 2018 年 10 月 18 日
That worked very nice (attached plot). I still need to figure out the labeling for the azimuth axis with this circle introduced because it does not show all angles and grid lines if the graph is incomplete, but at least I covered the gap with NaNs. Thank you!
djr
djr 2018 年 10 月 18 日
How do I accept your answer in this comment section? :) I do not see an accept answer button.
Chad Greene
Chad Greene 2018 年 10 月 18 日
Ah, I should know better!

サインインしてコメントする。

 採用された回答

Chad Greene
Chad Greene 2018 年 10 月 18 日

0 投票

What if you draw a gray circle the size of your polar graph, then plot the polar graph on top of it?

2 件のコメント

Chad Greene
Chad Greene 2018 年 10 月 18 日
In response to the missing grid ticks--Here's a somewhat absurd solution, but maybe it will work:
1. Plot the polar plot with NaNs set to zero. 2. Plot the gray circle. 3. Plot the polar plot with NaNs transparent.
djr
djr 2018 年 10 月 18 日
I'll give it a try... it's a brute force method. :)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangePolar Plots についてさらに検索

タグ

質問済み:

djr
2018 年 10 月 17 日

コメント済み:

djr
2018 年 10 月 18 日

Community Treasure Hunt

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

Start Hunting!

Translated by