フィルターのクリア

Change the style of the lines/grids in polar plot

9 ビュー (過去 30 日間)
Yang Hu
Yang Hu 2023 年 10 月 29 日
コメント済み: Yang Hu 2023 年 10 月 30 日
Hi everyone, I want to edit the style of the grid/line in a polar plot to make them more visible. But I am having trouble with my current sloppy code. The grids/lines are not showing up as they are supposed to.
clc
clear
A = readmatrix('male_nuclei_control.xlsx');
angle = A(:,5);
figure;
pax = polaraxes; %https://www.mathworks.com/help/matlab/ref/thetalim.html
thetalim('auto');
AR = A(:,6);
th = deg2rad(angle);
r = AR;
sz = 100;
c = 'k';% change color based on need, purple [.5 0 .5]
facecolor = [1 .5 0];% set face color to fill dots, orange [1 .5 0];
polarscatter(pax,th,r,sz,c,'LineWidth',1.5,'MarkerFaceColor',facecolor, 'visible', 'on');% if the circles not needed to be filled, delete it
% if need to be filled, type 'filled' after c
set(gca,'color',[.7 .7 .7 0.5]);% set background color [.7 .7 .7] is grey, [.7 .7 .7 0.5} is 50% transparent grey
pax.GridColor = 'k';
pax.Layer = 'top';
% polarscatter(th,r,sz,c,'LineWidth',1.5);% if the circles not needed to be filled, delete it
% if need to be filled, type 'filled' after c
thetalim(pax,[0 180]);
% pax = gca;% redefine font size
pax.FontSize = 18;% redefine font size
set(gcf, 'Position', [50, 100, 800, 400]);

採用された回答

Francesco
Francesco 2023 年 10 月 29 日
編集済み: Francesco 2023 年 10 月 29 日
Hi,
I am not sure I fully understand the question, but you could try altering the "LineWidth" and "GridAlpha" properties for the polar axes to make the grid more visible. I tried tweaking your code with the following settings inserted after line 24:
pax.LineWidth = 4;
pax.GridAlpha = .5;
and I think the grid looks much clearer now.
To change the line style you need to to set the "GridLineStyle" properties as desired. See the documentation on polar axes appearence and behavior: https://www.mathworks.com/help/matlab/ref/matlab.graphics.axis.polaraxes-properties.html
  1 件のコメント
Yang Hu
Yang Hu 2023 年 10 月 30 日
yes, this is exactlly what I am looking for, thank you.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePolar Plots についてさらに検索

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by