Azzera filtri
Azzera filtri

Change the style of the lines/grids in polar plot

9 visualizzazioni (ultimi 30 giorni)
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]);

Risposta accettata

Francesco
Francesco il 29 Ott 2023
Modificato: Francesco il 29 Ott 2023
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

Più risposte (0)

Categorie

Scopri di più su Polar Plots in Help Center e File Exchange

Prodotti


Release

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by