Groups of legends MATLAB

I use MATLAB to build some data. I would like to create a legend so that it divides the information into two types, for example Type1 and Type2. Each data type has several specific rows of data that I draw. Let's pretend that:

  • Type1 data has row 1 and row2
  • Type 2 data has row1 and row2 and row3

This would make a 5-line plot. Now for the legend, I can do something like:

legend('Type1: line1','Type1: line2','Type2: line1', ... 'Type2: line2','Type2: line3'); 

But this repeats the β€œTypes”, and the best way is what it will look like:

(final conclusion of the legend)

  • Type1:
    • line1
    • line2
  • Type2:
    • line1
    • line2
    • line3

Many thanks. I hope you can help with my first question: D

+6
source share
1 answer

You can watch LEGENDFLEX , which you can download from Matlab File Sharing

+2
source

Source: https://habr.com/ru/post/892582/


All Articles