Plotting simultaneously to multiple axes in GUIDE
3 views (last 30 days)
Show older comments
Hello,
I have two individual external functions that produce "dynamic" plots that are animated using for loops. In my GUI code I have three axes. I want to simultaneously plot these "dynamic" plots in two specified axes when a button is pushed and these functions are called. I know that one would normally use set and handles.NameofyourAxes; however, since these are external functions that would - when run on their own - produce figures in which the dynamic plots run. Right now I am only able to display one of the functions in whatever axes the user clicks. How can simultaneously run two external graphing functions and control which of the three axes they plot to?
I have also experimented with gca, but I have had no luck. Thank You!
0 Comments
Answers (1)
Walter Roberson
on 13 Aug 2015
If the external routines use figure() to create a new figure each time, then you cannot force them to write the graphics into the place of your choice. If the external routines use gca() or just go ahead and do their plots then you can control which axes they write to by using axes() before invoking them.
However, if the external routines just go ahead and plot in whatever axes is current, and if both of them are using something like timers to trigger updates, then you cannot make them write in the correct axes: routines that do that are mis-written. (All routines that use timers to update should take care to save the target axes and take care to write to that axes in all graphics operations.)
It is difficult to say what would work without seeing how the external routines are handling their graphics.
3 Comments
Walter Roberson
on 14 Aug 2015
If the external routines are not creating their own figure or axes then in your script use
axes(handle_where_you_want_the_output);
and then call the routine.
If the external routines do create their own figures, then there is nothing you can do ahead of time to force them to draw where you want, but afterwards you can move it from the other figure into the place that you want.
See Also
Categories
Find more on Specifying Target for Graphics Output in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!