Clear Filters
Clear Filters

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

4 views (last 30 days)
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 Comments
Walter Roberson
Walter Roberson on 12 Oct 2016
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 on 12 Oct 2016
Yes, that did the trick!! Thanks!
I do have R2015a, but for now this seems to work. Let's see what comes up next... ;)

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!