Having to develop MATLAB plots on a sporadic basis, I usually need to remind myself on the details of how they are done.
MathWorks provide a gallery of plot examples along with sample code that can be used as starting points. In the code they provide, the formatting for plot elements is not always done using element handles. Instead the code to format elements relies upon being written directly after the creation of the element. As the newly created element’s handle is by default in focus at that point in the code the formatting works. However by explicitly using the handles of the plot elements each time you want to apply formatting, the code can be rearranged into blocks of code that may be more logical to the programmer.
For this reason, I created a MATLAB plot template, that includes elements I typically use, with all the formatting done using element handles.