File Exchange Pick of the Week

Our best user submissions

Multi-column legend, revisited

Jiro‘s Pick this week is the NumColumns property of the legend function, new as of R2018a.

This week, R2019a was released. This is another exciting release with many new features and capabilities. Read and learn about them here (note that this page will always show the latest features from the latest release, so depending on when you read this, you may get a page for other than R2019a).

So why am I talking about a feature from R2018a? There are two reasons.

  1. The NumColumns property of legend allows you to create a multi-column legend, which happened to be a topic of a previous Pick of the Week post, “Create Multi-Column Plot Legends” by Brett. columnlegend by Simon is still a good entry to have in your utility belt if you are using R2017b or older, but if you have newer releases, you can now do that with the legend function.
  2. We were looking at some web traffic analytics, and we found out that the Pick of the Week post I mentioned above kept getting a lot of traffic even after 8 years. That meant that there were probably a lot of people wanting to create multi-column legends, and they were landing on the blog post. For those people, I wanted to make sure that they knew about the new feature, in addition to the File Exchange entry.

So, let’s just see the new legend functionality in action.

t = 0:pi/64:3*pi;
dPhi = pi/16;
hold on
for ii = 1:18
    legend_str{ii} = num2str(ii);
ylim([-1.15 1.6])



Give it a try and let us know what you think here. And, you can probably expect future posts highlighting some new R2019a features.

Published with MATLAB® R2018b

  • print


要发表评论,请点击 此处 登录到您的 MathWorks 帐户或创建一个新帐户。