<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>OuterPosition &#8211; Undocumented Matlab</title>
	<atom:link href="https://undocumentedmatlab.com/articles/tag/outerposition/feed" rel="self" type="application/rss+xml" />
	<link>https://undocumentedmatlab.com</link>
	<description>Professional Matlab consulting, development and training</description>
	<lastBuildDate>Wed, 24 Mar 2010 18:14:59 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.2</generator>
	<item>
		<title>Axes LooseInset property</title>
		<link>https://undocumentedmatlab.com/articles/axes-looseinset-property?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=axes-looseinset-property</link>
					<comments>https://undocumentedmatlab.com/articles/axes-looseinset-property#comments</comments>
		
		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Wed, 24 Mar 2010 18:14:59 +0000</pubDate>
				<category><![CDATA[Handle graphics]]></category>
		<category><![CDATA[Hidden property]]></category>
		<category><![CDATA[Low risk of breaking in future versions]]></category>
		<category><![CDATA[OuterPosition]]></category>
		<category><![CDATA[Pure Matlab]]></category>
		<category><![CDATA[Undocumented property]]></category>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=1240</guid>

					<description><![CDATA[<p>Matlab plot axes have an undocumented LooseInset property that sets empty margins around the axes, and can be set to provide a tighter fit of the axes to their surroundings.</p>
<p>The post <a rel="nofollow" href="https://undocumentedmatlab.com/articles/axes-looseinset-property">Axes LooseInset property</a> appeared first on <a rel="nofollow" href="https://undocumentedmatlab.com">Undocumented Matlab</a>.</p>
<div class='yarpp-related-rss'>
<h3>Related posts:</h3><ol>
<li><a href="https://undocumentedmatlab.com/articles/customizing-axes-part-4-additional-properties" rel="bookmark" title="Customizing axes part 4 &#8211; additional properties">Customizing axes part 4 &#8211; additional properties </a> <small>Matlab HG2 axes can be customized in many different ways. This article explains some of the undocumented aspects. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/customizing-axes-tick-labels" rel="bookmark" title="Customizing axes tick labels">Customizing axes tick labels </a> <small>Multiple customizations can be applied to tick labels. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/customizing-axes-part-3-backdrop" rel="bookmark" title="Customizing axes part 3 &#8211; Backdrop">Customizing axes part 3 &#8211; Backdrop </a> <small>Matlab HG2 axes can be customized in many different ways. This article explains some of the undocumented aspects. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/plot-linesmoothing-property" rel="bookmark" title="Plot LineSmoothing property">Plot LineSmoothing property </a> <small>LineSmoothing is a hidden and undocumented plot line property that creates anti-aliased (smooth unpixelized) lines in Matlab plots...</small></li>
</ol>
</div>
]]></description>
										<content:encoded><![CDATA[<p>Last week, I wrote an article about the hidden/undocumented <a target="_blank" href="/articles/plot-linesmoothing-property/"><strong>LineSmoothing</strong> plot property</a>. This week, I want to introduce another useful hidden/undocumented property &#8211; the plot axes&#8217; <strong>LooseInset</strong> property. This follows on the wake of an email I received from a reader about this property, which had some new information for me (thanks Ben!).<br />
Apparently, <strong>LooseInset</strong>, which is automatically set to a factory value of [0.13, 0.11, 0.095, 0.075], is used by Matlab axes to reserve a small empty margin around the axes, presumably to enable space for tick marks. These empty margins can be very annoying at times, especially when we have directly control on the axes contents.</p>
<pre lang="matlab">figure; t=0:0.01:7; plot(t,2*sin(t));</pre>
<p><center><figure style="width: 323px" class="wp-caption aligncenter"><img fetchpriority="high" decoding="async" alt="Axes with default LooseInset values (note the excessive margins)" src="https://undocumentedmatlab.com/images/LooseInset_default.png" title="Axes with default LooseInset values (note the excessive margins)" width="323" height="284" /><figcaption class="wp-caption-text">Axes with default LooseInset values<br />(note the excessive margins)</figcaption></figure></center><br />
If you set <strong>Position</strong> to [0 0 1 1], the labels are cut-off; if you set <strong>Position</strong> to something like [0.05 0.05 0.9 0.9], you can get the labels to show up, but if you now resize the image the labels may be cut off&#8230; Similarly, setting <strong>TightInset</strong> also does not work.<br />
Theoretically, the solution should be to set <strong>OuterPosition</strong> to [0 0 1 1]. This is supposed to make the axes (including labels) take up the entire figure. However, it usually over-estimates the required margins, causing wasted space. Using <strong>OuterPosition</strong> also causes <a target="_blank" rel="nofollow" href="http://www.mathworks.com/support/solutions/en/data/1-1ZOG12/">unexpected behaviors with sub-plots</a>.<br />
Solution: simply set <strong>LooseInset</strong> to [0 0 0 0]:</p>
<pre lang="matlab">set(gca, 'LooseInset', [0,0,0,0]);</pre>
<p><center><figure style="width: 323px" class="wp-caption aligncenter"><img decoding="async" alt="Axes with empty LooseInset values" src="https://undocumentedmatlab.com/images/LooseInset_empty.png" title="Axes with empty LooseInset values" width="323" height="284" /><figcaption class="wp-caption-text">Axes with empty LooseInset values</figcaption></figure></center><br />
To modify all future axes in the same way (i.e., have an empty <strong>LooseInset</strong>):</p>
<pre lang="matlab">set(0,'DefaultAxesLooseInset',[0,0,0,0])</pre>
<p>Clearing the <strong>LooseInset</strong> margins has a drawback: if the axes is zoomed or modified in such a way that the labels change, then the active axes plot region needs to shrink accordingly. For example:<br />
<center><figure style="width: 323px" class="wp-caption aligncenter"><img decoding="async" alt="Axes with empty LooseInset values, wide tick labels (note the changed plot region size)" src="https://undocumentedmatlab.com/images/LooseInset_empty2.png" title="Axes with empty LooseInset values, wide tick labels (note the changed plot region size)" width="323" height="284" /><figcaption class="wp-caption-text">Axes with empty LooseInset values, wide tick labels<br />(note the changed plot region size)</figcaption></figure></center><br />
When determining the size of the axes, it seems that Matlab takes into account larger of the <a target="_blank" rel="nofollow" href="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/axes_props.html#TightInset">documented</a> <strong>TightInset</strong> and the undocumented <strong>LooseInset</strong>. So, perhaps a better generic solution would be the one <a target="_blank" rel="nofollow" href="http://dopplershifted.blogspot.com/2008/07/programmatically-saving-matlab-figures.html#c3830299630471935212">suggested</a> by another blog reader:</p>
<pre lang="matlab">set(gca,'LooseInset',get(gca,'TightInset'))</pre>
<p>Note that the <strong>LooseInset</strong> property was first <a target="_blank" rel="nofollow" href="https://www.mathworks.com/matlabcentral/newsreader/view_thread/156326#394470">reported on CSSM</a> back in 2007 (also <a target="_blank" rel="nofollow" href="https://www.mathworks.com/matlabcentral/newsreader/view_thread/140047#352929">here</a>). The <strong>LooseInset</strong> property has remained hidden and undocumented to this day (Matlab 7.10, R2010a), although it has even featured in an official MathWorks <a target="_blank" rel="nofollow" href="http://www.mathworks.com/support/solutions/en/data/1-1ZOG12/">Technical Solution to a reported problem about unexpected axes sizes</a> last year.<br />
p.s. &#8211; another undocumented property of Matlab axes, <strong>ContentsVisible</strong>, was described by Matt Whittaker in a <a target="_blank" rel="nofollow" href="/articles/displaying-hidden-handle-properties/comment-page-1/#comment-677">comment</a> on my original article that introduced undocumented properties.</p>
<p>The post <a rel="nofollow" href="https://undocumentedmatlab.com/articles/axes-looseinset-property">Axes LooseInset property</a> appeared first on <a rel="nofollow" href="https://undocumentedmatlab.com">Undocumented Matlab</a>.</p>
<div class='yarpp-related-rss'>
<h3>Related posts:</h3><ol>
<li><a href="https://undocumentedmatlab.com/articles/customizing-axes-part-4-additional-properties" rel="bookmark" title="Customizing axes part 4 &#8211; additional properties">Customizing axes part 4 &#8211; additional properties </a> <small>Matlab HG2 axes can be customized in many different ways. This article explains some of the undocumented aspects. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/customizing-axes-tick-labels" rel="bookmark" title="Customizing axes tick labels">Customizing axes tick labels </a> <small>Multiple customizations can be applied to tick labels. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/customizing-axes-part-3-backdrop" rel="bookmark" title="Customizing axes part 3 &#8211; Backdrop">Customizing axes part 3 &#8211; Backdrop </a> <small>Matlab HG2 axes can be customized in many different ways. This article explains some of the undocumented aspects. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/plot-linesmoothing-property" rel="bookmark" title="Plot LineSmoothing property">Plot LineSmoothing property </a> <small>LineSmoothing is a hidden and undocumented plot line property that creates anti-aliased (smooth unpixelized) lines in Matlab plots...</small></li>
</ol>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://undocumentedmatlab.com/articles/axes-looseinset-property/feed</wfw:commentRss>
			<slash:comments>21</slash:comments>
		
		
			</item>
		<item>
		<title>Displaying hidden handle properties</title>
		<link>https://undocumentedmatlab.com/articles/displaying-hidden-handle-properties?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=displaying-hidden-handle-properties</link>
					<comments>https://undocumentedmatlab.com/articles/displaying-hidden-handle-properties#comments</comments>
		
		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Tue, 05 May 2009 23:03:55 +0000</pubDate>
				<category><![CDATA[Hidden property]]></category>
		<category><![CDATA[High risk of breaking in future versions]]></category>
		<category><![CDATA[JavaFrame]]></category>
		<category><![CDATA[OuterPosition]]></category>
		<category><![CDATA[PixelBounds]]></category>
		<category><![CDATA[schema.class]]></category>
		<category><![CDATA[schema.prop]]></category>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=237</guid>

					<description><![CDATA[<p>I present two ways of checking undocumented hidden properties in Matlab Handle Graphics (HG) handles</p>
<p>The post <a rel="nofollow" href="https://undocumentedmatlab.com/articles/displaying-hidden-handle-properties">Displaying hidden handle properties</a> appeared first on <a rel="nofollow" href="https://undocumentedmatlab.com">Undocumented Matlab</a>.</p>
<div class='yarpp-related-rss'>
<h3>Related posts:</h3><ol>
<li><a href="https://undocumentedmatlab.com/articles/performance-accessing-handle-properties" rel="bookmark" title="Performance: accessing handle properties">Performance: accessing handle properties </a> <small>Handle object property access (get/set) performance can be significantly improved using dot-notation. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/adding-custom-properties-to-gui-objects" rel="bookmark" title="Adding custom properties to GUI objects">Adding custom properties to GUI objects </a> <small>It is very easy to add custom user-defined properties and methods to GUI handles and Java references in Matlab. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/handle-graphics-behavior" rel="bookmark" title="Handle Graphics Behavior">Handle Graphics Behavior </a> <small>HG behaviors are an important aspect of Matlab graphics that enable custom control of handle functionality. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/hidden-hg2-plot-functionality" rel="bookmark" title="Accessing hidden HG2 plot functionality">Accessing hidden HG2 plot functionality </a> <small>In HG2, some of the plot functionality is hidden in undocumented properties. ...</small></li>
</ol>
</div>
]]></description>
										<content:encoded><![CDATA[<p>Matlab Handle Graphics (HG) is a great way to manipulate GUI objects. HG handles often have some undocumented hidden properties. One pretty well-known example is the <strong>JavaFrame</strong> property of the figure handle, which enables access to the GUI&#8217;s underlying Java peer object.  We can use hidden properties just like any other handle property, using the built-in <b><i>get</i></b> and <b><i>set</i></b> functions.<br />
But how can we know about these properties? Here are two methods to do so. Like the hidden properties, these two methods are themselves undocumented&#8230;<br />
1. use the desktop&#8217;s hidden <strong>HideUndocumented</strong> property:</p>
<blockquote>
<pre><span style="color: #000000">set(0,</span><span style="color: #800080">'HideUndocumented','off'</span><span style="color: #000000">);</pre>
</blockquote>
<p>From now on, when displaying handle properties using <b><i>get</i></b> and <b><i>set</i></b> you&#8217;ll see the hidden properties.<br />
Note that some of the properties might display a warning indication:</p>
<blockquote>
<pre><span style="color: #000000">>> get(gcf)</span>
	Alphamap = [ (1 by 64) double array]
	BackingStore = on
	CloseRequestFcn = closereq
	Color = [0.8 0.8 0.8]
	Colormap = [ (64 by 3) double array]
	CurrentAxes = []
	CurrentCharacter =
	CurrentKey =
	CurrentModifier = [ (1 by 0) cell array]
	CurrentObject = []
	CurrentPoint = [0 0]
	Dithermap<span style="color: #800000">Warning: figure Dithermap is no longer useful
 with TrueColor displays, and will be removed in a future release.</span>
 = [ (64 by 3) double array]
        ...
</pre>
</blockquote>
<p>2. Access the properties&#8217; definition in the handle&#8217;s class definition:</p>
<blockquote>
<pre><span style="color: #000000">>> ch = classhandle(handle(gcf));
>> props = get(ch,</span><span style="color: #800080">'Properties'</span><span style="color: #000000">);
>> propsVisibility = get(props,</span><span style="color: #800080">'Visible'</span><span style="color: #000000">)';
>> hiddenProps = props(strcmp(propsVisibility,</span><span style="color: #800080">'off'</span><span style="color: #000000">));
>> sort(get(hiddenProps,</span><span style="color: #800080">'Name'</span><span style="color: #000000">))</span>
ans =
    'ALimInclude'
    'ActivePositionProperty'
    'ApplicationData'
    'BackingStore'
    'Behavior'
    'CLimInclude'
    'CurrentKey'
    'CurrentModifier'
    'Dithermap'
    'DithermapMode'
    'ExportTemplate'
    'HelpFcn'
    'HelpTopicKey'
    'HelpTopicMap'
    'IncludeRenderer'
    'JavaFrame'
    'OuterPosition'
    'PixelBounds'
    'PrintTemplate'
    'Serializable'
    'ShareColors'
    'UseHG2'
    'WaitStatus'
    'XLimInclude'
    'YLimInclude'
    'ZLimInclude'
</pre>
</blockquote>
<p>Different HG handles have different hidden properties. Not all these properties are useful. For example, I have found the <strong>PixelBounds</strong> property to be problematic &#8211; (it sometimes reports incorrect values!). Other properties (like <strong>Dithermap</strong> or <strong>ShareColors</strong>) are deprecated and display a warning wherever they are accessed.<br />
But every so often we find a hidden property that can be of some actual benefit. Let&#8217;s take the figure handle&#8217;s <strong>OuterPosition</strong> property for example. It provides the figure&#8217;s external position values, including the space used by the window frame, toolbars etc., whereas the regular documented <strong>Position</strong> property only reports the <b>internal</b> bounds:</p>
<blockquote>
<pre><span style="color: #000000">>> get(gcf,</span><span style="color: #800080">'pos'</span>)
ans =
   232   246   560   420
<span style="color: #000000">>> get(gcf,</span><span style="color: #800080">'outer'</span>)
ans =
   228   242   568   502
</pre>
</blockquote>
<p>In future posts I will sometimes use such hidden properties. You can find the latest list by looking at this blog&#8217;s <a href="/articles/category/Hidden-property/" target="_blank">&#8220;Hidden property&#8221;</a> category page.<br />
Note: Like the rest of Matlab&#8217;s undocumented items, all hidden properties are undocumented, unsupported and may well change in future Matlab releases so use them with care.<br />
Did you find any useful hidden property? If so, then please leave your finding in the comments section below.</p>
<p>The post <a rel="nofollow" href="https://undocumentedmatlab.com/articles/displaying-hidden-handle-properties">Displaying hidden handle properties</a> appeared first on <a rel="nofollow" href="https://undocumentedmatlab.com">Undocumented Matlab</a>.</p>
<div class='yarpp-related-rss'>
<h3>Related posts:</h3><ol>
<li><a href="https://undocumentedmatlab.com/articles/performance-accessing-handle-properties" rel="bookmark" title="Performance: accessing handle properties">Performance: accessing handle properties </a> <small>Handle object property access (get/set) performance can be significantly improved using dot-notation. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/adding-custom-properties-to-gui-objects" rel="bookmark" title="Adding custom properties to GUI objects">Adding custom properties to GUI objects </a> <small>It is very easy to add custom user-defined properties and methods to GUI handles and Java references in Matlab. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/handle-graphics-behavior" rel="bookmark" title="Handle Graphics Behavior">Handle Graphics Behavior </a> <small>HG behaviors are an important aspect of Matlab graphics that enable custom control of handle functionality. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/hidden-hg2-plot-functionality" rel="bookmark" title="Accessing hidden HG2 plot functionality">Accessing hidden HG2 plot functionality </a> <small>In HG2, some of the plot functionality is hidden in undocumented properties. ...</small></li>
</ol>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://undocumentedmatlab.com/articles/displaying-hidden-handle-properties/feed</wfw:commentRss>
			<slash:comments>15</slash:comments>
		
		
			</item>
	</channel>
</rss>
