legend positions the legend based on a variety of factors, such as what objects the legend obscures. Then you can change their text colors separately. In most cases, when you use name-value pairs, you must specify the labels in a cell array, such as legend({'label1','label2'},'FontSize',14).. Use the Legend object. I have then a plot, and I can get the numbers as legend by writing legend(num2str(x(1)),.....), but I also want one letter after each number in the legend. For the labels, the legend uses the text from the DisplayName properties of the data series. Figure legend is being cut off MATLAB. legend creates a legend with descriptive labels for each plotted data series. To change the legend text colors individually, you have to first get the handles to the text objects, which are children of the legend object. I am trying to include a legend within my matlab plot which uses the Latex interpreter for the legend text. By default, the legend annotates the current axes. I have then a plot, and I can get the numbers as legend by writing legend(num2str(x(1)),.....), but I also want one letter after each number in the legend. Modifiers remain in effect until the end of the text. legend associates strings with the objects in the axes in the same order that they are listed in the axes Children property. Browse other questions tagged matlab legend matlab-figure or ask your own question. I am just trying to improve the readability of my plot, i feel as it is currently, there is just too much space between the legend text and the symbols – mrsoltys Jul 1 '13 at 3:44 Superscripts and subscripts are an exception because they modify only the next … You can use the text function to add text to a Matlab figure. I have a matrix called x, which contains 8 numbers. Sounds simple enough. When I set the legend to use the Latex interpreter though, the text within overflows outside the legend box. Thanks, Good Idea, but this causes the legend text to overlap with the symbols. Today I will expand on that article by explaining the plot legend’s internal graphics hierarchy, how we can … This blog post was supposed to be a piece of cake: The problem description was that we wish to display a text title next to the legend box in plot axes. If the DisplayName property is empty, then the legend uses a label of the form 'dataN'.The legend automatically updates when you add or delete data series from the axes. I have a matrix called x, which contains 8 numbers. MATLAB displays only one legend per axes. I have tried adjusting the size of the text, but this occurs regardless of the FontSize. It's use is >> text(x, y, str); where x and y are the coordinates in the figure where you want to add the text str. 3. 2. After all, in HG1 (R2014a and earlier), a legend was a simple wrapper around a standard Matlab … You can use the Color option of text for colours and TeX to draw lines or even _. I've gotten very creative with plots using text. ... Matlab legend color incorrect, in a loop of variable size, reading in legend names. MATLAB interprets the TeX markup as long as the Interpreter property of the text object is set to 'tex' (the default). The Overflow Blog Podcast – 25 Years of Java: the past to the present You can return the Legend object as an output argument from the legend function, such as lgd = legend.Then, use lgd with dot notation to set properties, such as lgd.FontSize = 14. Three years ago I explained how we can use a couple of undocumented hidden properties of the legend in order to add a legend title (the legend object had no Title property back then – this was only added in a later Matlab release, perhaps as a result of my post). Use name-value pairs in the legend command.