- Undocumented Matlab - https://undocumentedmatlab.com -
Plot LimInclude properties
Posted By Yair Altman On March 31, 2010 | 9 Comments
Concluding my three-part mini-series on hidden and undocumented plot/axes properties, I would like to present a set of properties that I find very useful in dynamic plots: XLimInclude, YLimInclude, ZLimInclude, ALimInclude and CLimInclude. These properties, which are relevant for plot/axes objects, have an ‘on’ value by default. When set to ‘off’, they exclude their object from the automatic computation of the corresponding axes limits (XLim/YLim/ZLim/ALim/CLim).
For example, here’s a simple sine wave with a wavefront line marker. Note how the too-tall wavefront line affects the entire axes Y-limits:
cla;
t=0:.01:7.5;
plot(t,sin(t));
line('xdata',[7.5,7.5], 'ydata',[-5,5], 'color','r');
box off
cla;
t=0:.01:7.5;
plot(t,sin(t));
line('xdata',[7.5,7.5], 'ydata',[-5,5], 'color','r', ...
'YLimInclude','off');
box off
hWavefront = line(..., 'YData',[-99,99], 'YLimInclude','off');
Now the wavefront line never needed to update its YData (only XData, which is much less CPU-intensive) – it always spanned the entire axes height, since [-99,99] were assured (in my particular case) to exceed the actual monitored data. This looked better (no flicker effects) and performed faster than the regular (documented) approach.
Note that although all these properties exist, to the best of my knowledge, for all Handle-Graphic plot objects, they are sometimes meaningless. For example, ZLimInclude is irrelevant for a 2D patchless plot; CLimInclude relates to the axes color limits which are irrelevant if you’re not using a colormap or something similar; ALimInclude relates to patch transparency (alpha-channel) and is irrelevant elsewhere. In these and similar cases, setting these properties, while allowed and harmless, will simply have no effect.
This concludes my mini-series of undocumented plot/axes properties. To recap, the other articles dealt with the LooseInset [1] and LineSmoothing [2] properties.
Have you found other similar properties or use-cases that you find useful? I will be most interested to read about them in the comments section below.
Categories: Handle graphics, Hidden property, Low risk of breaking in future versions, Stock Matlab function, Undocumented feature
Article printed from Undocumented Matlab: https://undocumentedmatlab.com
URL to article: https://undocumentedmatlab.com/articles/plot-liminclude-properties
URLs in this post:
[1] LooseInset: http://undocumentedmatlab.com/blog/axes-looseinset-property/
[2] LineSmoothing: http://undocumentedmatlab.com/blog/plot-linesmoothing-property/
[3] Borderless button used for plot properties : https://undocumentedmatlab.com/articles/borderless-button-used-for-plot-properties
[4] Bar plot customizations : https://undocumentedmatlab.com/articles/bar-plot-customizations
[5] Plot performance : https://undocumentedmatlab.com/articles/plot-performance
[6] Controlling plot data-tips : https://undocumentedmatlab.com/articles/controlling-plot-data-tips
[7] Accessing plot brushed data : https://undocumentedmatlab.com/articles/accessing-plot-brushed-data
[8] getundoc – get undocumented object properties : https://undocumentedmatlab.com/articles/getundoc-get-undocumented-object-properties
[9] : https://www.mathworks.com/matlabcentral/newsreader/view_thread/295878#812396
Click here to print.
Copyright © Yair Altman - Undocumented Matlab. All rights reserved.
9 Comments To "Plot LimInclude properties"
#1 Comment By Matt Whitaker On March 31, 2010 @ 14:42
Hi Yair,
Thanks, I think this will be very useful when you have a lot of graphics objects on the axes but you know what the overall dimensions will be. I’ll be trying this tip out right away.
Perhaps you could expand on why you would use this in place of setting the YLImMode as in:
#2 Comment By Yair Altman On March 31, 2010 @ 22:56
@Matt – that’s exactly the point: I want the limits to remain automatic and be updated with the plot data – I just don’t want some particular elements, like the wavefront line, to influence the limits. In your solution, if I now modify the plot data, the axes limits will remain fixed at they previous state.
#3 Comment By Matt Whitaker On April 1, 2010 @ 08:29
Ok got it now.
So if I run the code below it illustrates the point:
#4 Comment By Yair Altman On April 1, 2010 @ 11:28
exactly – thanks for the clarification example
#5 Comment By Matt Whitaker On August 6, 2010 @ 15:26
Hi Yair,
Glad I remembered this tip. Had a plot with 50+ draggable lines on it that updated other plots. Much smoother when I remembered this tip and turned off the XLimInclude , YLimInclude for the draggable lines and the line plot they were updating.
Thanks
Matt
#6 Comment By Yair Altman On January 14, 2011 @ 03:54
For anyone interested, there appears to be an anomaly when using the LimInclude properties with hgtransform: [9]
– Yair
#7 Pingback By datestr performance | Undocumented Matlab On October 5, 2011 @ 13:20
[…] Different performance hotspots can have different solutions: caching, vectorization, internal library functions, undocumented graphics properties, smart property selection, smart function selection, smart indexing, smart parameter selection etc. […]
#8 Pingback By HG2 update | Undocumented Matlab On May 16, 2013 @ 07:54
[…] axes no longer have *LimInclude properties (this actually makes sense – these properties are still available in plot lines […]
#9 Pingback By Customizing axes part 2 | Undocumented Matlab On October 22, 2014 @ 11:03
[…] In HG1, we could do this programmatically using extra line commands (presumably with the additional *LimInclude properties). In HG2 it becomes easier – we can simply update the relevant baseline’s properties: […]