set uiaxes in matlab function as current figure to plot on
26 views (last 30 days)
I had a question on how to plot on uiaxes from an m-file. This question got solved:
I wonder if there's a more elgant way to solve this problem by defining the axes at the beginning of the function and then continuously plot on it instead of defining the axes in every single plot command?! Something like:
Call of function:
% plot 1
% plot 2
% plot x
It works fine the way it is right now, but what if I have an old function with lots of plot commands I want to include to a gui?
J. Alex Lee on 8 Oct 2020
I would argue that it makes more sense (more elegant) to require specifying the parent axes to plot. The way that you want may cut down on some letters, but to me is less elegant and more prone to problems and confusion.
I would take the advice of the comment in the other answer: ctrl+F to update your old code.