Check out example codes for "clear scatter plot matlab". It will help you in understanding the concepts better.
Code Example 1
figure
hold on
h1 = plot(1:10,'r');
h2 = plot(2:11,'g');
if <your condition doesn't hold>
set(h2,'Visible','off')
end
Learn ReactJs, React Native from akashmittal.com