Search code examples
matlabmatlab-figurepolar-coordinates

How to scale amplitude of polar plot?


I have a matrix of data. I used the polarplot command in MATLAB to plot this matrix with respect to theta.

The data oscillates between 3999.20 and 4001.52 As you can see in the following plot, the order of magnitude of oscillation of data is too small to see.

How can I modify my polar plot to see small oscillations?

My code is as below:

yf=[%750 data point]
theta = 0:4*pi/749:4*pi;
rho = yf
pax = polaraxes;
polarplot(theta,rho)
pax.ThetaDir = 'counterclockwise';
pax.ThetaZeroLocation='right'
pax.ThetaColor='r'
pax.ThetaTick=[0 30 60 90 120 150 180 210 240 270 300 330 ];
pax.RDir='normal';
pax.RTick=[3999.34 3999.67 4000 4000.33 4000.66 4000.99 4001.33 ]
pax.FontSize = 12;

Desired output:

expected plot

Actual output

unwanted result.

2-axis plot

picture of simple plot of  the matrix of data


Solution

  • To give an example of setting the r limits as suggested by @beaker

    The following code uses the same data with using rlim to set manual limits in the second example. This scales the polar axis so that it only plots values between [3999,4000], exaggerating the scale of the oscillation.

    theta = 0:0.01:2*pi;
    rho = sin(2*theta).*cos(2*theta) + 3999 %To approximate your data
    
    figure;
    subplot(1,2,1)
    polarplot(theta,rho)
    title('Automatic r-limits')
    
    subplot(1,2,2)
    polarplot(theta,rho)
    rlim([3999, 4000])
    title('rlim([3999, 4000])')
    

    Figure comparing r limits