Matlab legend with two handles, shows only 1 type of marker

4 次查看(过去 30 天)
Hi,
I am trying to create a legend to a plot with two point distributions. Each distribution thereby has it's own marker type and can be accessed through a handler.
Now, I created the legend using
legend([handle_1; handle_2],{'bla','blo'});
However, the legend only shows the marker type of the handle_1 for both entries. If I switch handle_1 and handle_2, the legend only shows the marker type of handle_2 for both entries (see picture).
I would like the legend to show both marker types. Does anybody know what I did wrong?
  2 个评论
Walter Roberson
Walter Roberson 2016-10-12
Which MATLAB release are you using? There was a bug along these lines, I think it might have been R2015a.
The alternative explanation is that your handle_1 and handle_2 might be vectors of handles. Try
legend([handle_1(1); handle_2(1)],{'bla','blo'});
Luke Skywalker
Luke Skywalker 2016-10-12
Yes, that did the trick!! Thanks!
I do have R2015a, but for now this seems to work. Let's see what comes up next... ;)

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Legend 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by