Pass Two Handles to the same plot/Using 'animated line' with multiple axes in GUI
13 views (last 30 days)
Anik Chaturbedi on 21 May 2015
Hi, This is my first time posting a question because this database is so extensive that I always found already-posted-answers whenever I had a question. Anyway, I'm trying to generate two plots in the same GUI. I'm using 'animated line' to plot. I don't want to use 'plot'. My code looks like this:
However, the second addpoints command is also plotting in the first plot (handle-liquid_compartment_graph) which I'm guessing is happening because the second addpoint is only considering the handle h4 and not the one directing it to the particular axes. Can anyone please suggest what can I do to: 1. Either pass both the handles (the one for the axes and the other one for animated line)? 2. Or some other way to plot multiple animated lines in different axes in one GUI?
You'll save my life if you can come up with an answer. Thanks a lot in advance.
Nade Sritanyaratana on 21 May 2015
Have you tried setting the "Parent" property of "h1" and "h4" to the desired axes (assuming they have been both created when "animatedline" was called)?
h1=animatedline('Marker','o','LineWidth',1,'Color','k', 'Parent', handles.liquid_compartment_graph); h4=animatedline('Marker','o','LineWidth',1,'Color','k', 'Parent', handles.solid_compartment_graph);
My guess is that "h1" and "h4" were created when "handles.liquid_compartment_graph" was the current axes.
The documentation pages for "animatedline" and its properties further elaborate on this behavior: http://www.mathworks.com/help/matlab/ref/animatedline.html http://www.mathworks.com/help/matlab/ref/animatedline-properties.html#property_parent