Function that creates figures only?
0 Comments
Accepted Answer
4 Comments
No, that proposed code creates figures as well as plotting, but the requirements of the question do not permit anything other than plotting to be done.
More Answers (2)
No, it is not possible in MATLAB to create a function that only produces plots without doing anything else.
In the case where there is no current axes then the function would have the side effect of also creating an axes (and possibly a figure too.)
In the case where there is an existing axes that is set to replace children, then the function would have the side effect of clearing the axes, unless the function also took the step of setting the axes to retain plots. However, setting the axes to retain plots would involve doing something additional to "just" producing plots.
If the axes is set to retain children, then plotting can have side effects on axes limits and ticks and potentially creating additional legend entries, and changing the index of the "current" color number.
It is difficult to create plots without any side effects unless you specifically control for the side effects, but that controlling is doing more than "just" plotting.
Sometimes my housemate hands me something and asks me to "just hold this". I can never do what they are asking: every single time I have to breathe as well, and breathing is not just holding the object.
2 Comments
See Also
Categories
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!