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

Error using matlab.graphics.layout.TiledChartLayout/get There is no units property....

Open ELePWAus opened this issue 5 years ago • 2 comments

Hi Kelly, I am enjoying the prospect of legendflex working for me. I've been through the example and think I understand the basics. However I get an error message which has no meaning for me: Even scanning documentation on TiledLayout, I get no clues about Units. Your para on units doesn't give examples of possible units, how to set them up, or why they are necessary.

legendflex(TilebotL, {'Median displacement'},'anchor',{'n','s'},'buffer',[0 0]) 'bufferunit', 'normalized'); Error using matlab.graphics.layout.TiledChartLayout/get There is no units property on the TiledChartLayout class. Error in getpos (line 117) current_ref_unit=get(href,'units'); Error in legendflex (line 465) legpospx = getpos(h.leg, 'px');

I am trying to add legends to scatterplots in the 3 lower panels Here is the bottom left panel: The legend it puts, is not in the position I tried to specify. panel drawing an error

It's yet another example of useless MATLAB error messages.

Thanks very much Eric

ELePWAus avatar Dec 11 '19 03:12 ELePWAus

I'm not familiar with TiledLayout; which version of Matlab are you running? Are you trying to use legendflex within App Designer, maybe, rather than a figure?

This error implies that the call to legend (the first step in creating the modified legendflex legend) created a TiledLayout object rather than a legend object, and that messes with the logic of the rest of the program. But I'll need to know more about the context to figure out how that happens and if there's a workaround for it. (I've never tried testing this outside of basic figure windows...).

kakearney avatar Dec 11 '19 13:12 kakearney

Following up on my own question... TiledChartLayout objects (created by tiledlayout function) were introduced in 2019b. It seems that rather than just creating a grid of axes, it wraps said axes in a custom object... probably need to drill down to the child axes when positioning the legend. Will need to investigate this, but first need to wait for my license to catch up (currently on 2019a).

kakearney avatar Apr 18 '20 00:04 kakearney