![]() You can give your plot a title (with the title command), x -axis label (with the xlabel command), y -axis label (with the ylabel command), and put text on the actual plot. It is possible to pass the string or character vector of legend. Adding text and legend Another thing that may be important for your plots is labeling. ![]() You can also use copyobj to copy graphics elements from one figure to another if you have a lot of elements, then use set(x, 'visible', 'off') to hide them before showing the legend, but it depends on what your final application is. Legend helps to identify the specific line among multiple lines available in the plot. ![]() This will plot the additional points, but they will not be visible on the plot itself. The elements to be added to the legend are automatically determined, when you do not pass in any extra arguments. The updated code above works, but the answer below is only relevant pre-2016b: figure In MATLAB, legends are those handy little boxes that label the data series in your plot, making it easier for viewers to understand what's going on. Legends, like the sidekicks in buddy-cop movies, provide essential context and support to the main attraction. This will plot the additional points, but because the coordinates are at NaN they will not be visible on the plot itself:ĮDIT : My original answer results in greyed out legend entries in 2016b. Understanding Legends In MATLAB A Legend-Ary Definition. ![]() This is how I have solved this problem in the past: figure 6 Answers Sorted by: 39 I do not like storing the handle values, it becomes a mess when I have a lot of graphs in my figures. ![]()
0 Comments
Leave a Reply. |