%% Refresh Plotted Data for One Line
% Refresh charted data for a specific line and leave other lines unchanged.
% First, plot two sets of polar data and return the Line objects.

theta = linspace(0,2*pi);
rho1 = sin(theta);
rho2 = -sin(theta);

px = polaraxes;
hold on;
ln1 = polarplot(theta,rho1);
ln2 = polarplot(theta,rho2);

%
% Set the RDataSource property for each line. Then, modify rho1 and rho2.

ln1.RDataSource = 'rho1';
ln2.RDataSource = 'rho2';

rho1 = 0.5*sin(theta);
rho2 = 0.5*cos(theta);

% Update only the first line by using ln1 as the input argument to refreshdata. Note that the second line remains unchanged.

refreshdata(ln1)

% Copyright 2019 The MathWorks, Inc.