milihis.blogg.se

Justin sin legend maker
Justin sin legend maker









justin sin legend maker

Some other examples, which I may cover in future posts, include text(…, ‘sc’), drawnow( ‘discard’), several options in pan and datacursormode etc. Even my reported workaround in January this year went unanswered (no hard feelings…).ĭynamicLegend is a good example of a useful semi-documented feature. This feature has existed many releases back (Matlab 7.1 for sure, perhaps earlier), so while it may be discontinued in some future Matlab release, it did have a very long life span… The down side is that it is not supported: I reported the bar/stairs issue back in mid-2007 and so far this has not been addressed (perhaps it will never be). It is an unsupported feature originally intended only for internal Matlab use (which of course doesn’t mean we can’t use it). This means that the feature is explained in a comment within the function (which can be seen via the edit( ‘legend’) command), that is nonetheless not part of the official help or doc sections. The DynamicLegend feature is semi-documented. – object visibility in the legend can be controlled on an object-by-object basis using the semi-documented hasbehavior function. My fix solves this, but I do not presume this solves all possible problems in all scenarios (please report if you find anything else). The origin of the bug is that bar and stairs generate hggroup plot-children, which saves the legend strings column-wise rather than the expected row-wise. To temporarily disable the DynamicLegend listener, do the following: For example, in my GUI I needed to plot several event lines which looked alike, and so I only wanted the first line to be added to the legend. It is sometimes necessary to selectively disable the dynamic behavior. We can see how the dynamic legend automatically keeps in sync with its associated axes contents when plot lines are added/removed, even down to the zoom-box lines… The legend automatically uses the plot lines ‘DisplayName’ property where available, or a standard ‘line#’ nametag where not available:ĭynamicLegend works by attaching a listener to the axes child addition/deletion callback (actually, it works on the scribe object, which is a large topic for several future posts).

justin sin legend maker

Hold all % add new plot lines on top of previous ones Hold all % add new plot lines on top of previous ones plot (x, cos (x ), 'DisplayName', 'cos' )

justin sin legend maker

Plot (x, sin (x ), 'DisplayName', 'sin' )











Justin sin legend maker