legendflex-pkg icon indicating copy to clipboard operation
legendflex-pkg copied to clipboard

Added support for skipping icon?

Open lynch730 opened this issue 6 years ago • 1 comments

Hello, I love the function; it's been rather helpful in generating plots!

I encountered the need to create tabular legends where certain entries (like row or column headers) are customized text and don't necessarily have a corresponding data series. I was able to pull this off, and I'm curious if you'd entertain a pull request.

Method: I can create dummy object entries to pass to legendflex like so:

dummyh = line(nan, nan, 'Linestyle', 'none', 'Marker', 'none', 'Color', 'none'); hln(2,1)=dummyh;

However this alone leaves empty space where the marker would be. Screenshot from 2019-10-04 15-01-57

I solved this by modifying the function to include an optional boolean input array "symbol" which turns symbols on or off, and seems to fix the issue. Legend text occupies the normal horizontal space, and if all entries in a column are voided, the size is reduced to the minimum size.

Screenshot from 2019-10-04 15-03-33

I have not stress-tested this, so I have no idea to what extent it would work for all possible cases.

lynch730 avatar Oct 04 '19 20:10 lynch730

I like this option, thanks! I'll put in on my testing list... I try to keep this function working across a number of Matlab releases, so it may be a while before I have time to fully test and integrate these changes across versions and plot types.

kakearney avatar Oct 04 '19 21:10 kakearney