![]() ![]() % web(fullfile(docroot, 'matlab/matlab_external/call-python-from-matlab. ![]() %% Using python's TextWrapper to wrap entries: I will first show the code and then provide a brief explanation of why/how it works. Here's a proof-of-concept of legend text wrapping, using some undocumented outputs of legend and the MATLAB -> python interface. The columnlegend package available in the Matlab File Exchange unfortunately does not support legends outside of the figure (at least the options are not specified in the description it only names the following possible locations: 'NorthWest', 'NorthEast', 'SouthEast', 'SouthWest' Help is appreciated. The columnlegend package available in the Matlab File Exchange unfortunately does not support legends outside of the figure (at least the options are not specified in the description it only names the following possible locations: 'NorthWest', 'NorthEast', 'SouthEast', 'SouthWest' I generated a new figure generally depicting what I am looking for (its made in Paint so it really just shows the general idea). If assuming now that the plot had more then four lines, lets say 20 and I want to have the legend southside horizontal in a way that it uses the least space, is there a way to split the legend not within one legend text, but after one entry. Although both of the answers provide some opportunities in splitting the legend into two lines, my main problem still occurs. before l3 or l4, here illustrated by the yellow or purple line).Īny ideas on this? I am using a plot width of 15.75 cm. I want to keep the orientation this way to reduce figure space needed and I want to put an automatic line break if the legend exceeds the picture width (i.e. Set(hLegend,'Fontsize',8,'Location', 'southoutside', 'Orientation','horizontal') Īs you can see I have four lines (there might come more) and the first one has a very long name. Therefore the question is how do I get a line break in my legend?Ĭurrently I generate the legend as follows: hLegend = legend(, 'This is a very, very long legend text', 'Test2'. The problem is that currently my legend is too long to fit on a single line. I have a plot with mutliple lines and I want to display the legend below the box ( southoutside).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |