Change the style of the lines/grids in polar plot
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]);
0 个评论
采纳的回答
FB
2023-10-29
编辑:FB
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
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Polar Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!