<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
	
	>
<channel>
	<title>
	Comments on: Customizing axes rulers	</title>
	<atom:link href="https://undocumentedmatlab.com/articles/customizing-axes-rulers/feed" rel="self" type="application/rss+xml" />
	<link>https://undocumentedmatlab.com/articles/customizing-axes-rulers?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=customizing-axes-rulers</link>
	<description>Professional Matlab consulting, development and training</description>
	<lastBuildDate>Tue, 09 Jul 2019 03:18:16 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.3</generator>
	<item>
		<title>
		By: James P. Herman		</title>
		<link>https://undocumentedmatlab.com/articles/customizing-axes-rulers#comment-485915</link>

		<dc:creator><![CDATA[James P. Herman]]></dc:creator>
		<pubDate>Tue, 09 Jul 2019 03:18:16 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=5116#comment-485915</guid>

					<description><![CDATA[Any thoughts on how to preserve axis offset in an exported PDF? Using export_fig or print both seem to restore the full size of the ruler:

&lt;pre lang=&quot;matlab&quot;&gt;
clear
close all

% make figure window
fh = figure(&#039;Color&#039;, [1 1 1]);

% make axes
ax = axes;

% plot some data
p = plot(randn(100,1));

% make sure objects have been created
drawnow;

% set axis properties
ax.Box     = &#039;Off&#039;;
ax.XLim    = [-10 110];
ax.XTick   = 0:25:100;
ax.YLim    = 4 * [-1 1];
ax.YTick   = -3:3;
ax.TickDir = &#039;Out&#039;;

% offset
ax.XAxis.Axle.VertexData = single([0 100; -4 -4; -1 1]);
ax.YAxis.Axle.VertexData = single([-10 -10; -3 3; -1 1]);

% print
print(&#039;-bestfit&#039;,&#039;-dpdf&#039;,&#039;-opengl&#039;,&#039;test&#039;);
&lt;/pre&gt;]]></description>
			<content:encoded><![CDATA[<p>Any thoughts on how to preserve axis offset in an exported PDF? Using export_fig or print both seem to restore the full size of the ruler:</p>
<pre lang="matlab">
clear
close all

% make figure window
fh = figure('Color', [1 1 1]);

% make axes
ax = axes;

% plot some data
p = plot(randn(100,1));

% make sure objects have been created
drawnow;

% set axis properties
ax.Box     = 'Off';
ax.XLim    = [-10 110];
ax.XTick   = 0:25:100;
ax.YLim    = 4 * [-1 1];
ax.YTick   = -3:3;
ax.TickDir = 'Out';

% offset
ax.XAxis.Axle.VertexData = single([0 100; -4 -4; -1 1]);
ax.YAxis.Axle.VertexData = single([-10 -10; -3 3; -1 1]);

% print
print('-bestfit','-dpdf','-opengl','test');
</pre>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/customizing-axes-rulers#comment-433365</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Wed, 25 Jul 2018 11:06:05 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=5116#comment-433365</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/customizing-axes-rulers#comment-433363&quot;&gt;vaishta&lt;/a&gt;.

@Vaishta - you have to read the Matlab documentation about how to create GUI callbacks and how to share data between GUI components/callbacks (&lt;a href=&quot;https://www.mathworks.com/help/matlab/creating_guis/share-data-among-callbacks.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;https://www.mathworks.com/help/matlab/creating_guis/share-data-among-callbacks.html&lt;/a&gt;). In general, you need to store the axes handles in a location that is accessible to the callback function (for example, in the button&#039;s UserData property). It looks like you&#039;re using GUIDE to create your GUI, and in this case you could also access the axes handles via the &lt;code&gt;handles&lt;/code&gt; structure. 

I&#039;m afraid that all this is pretty basic Matlab GUI stuff, which is not the subject of this blog - this blog specializes on advanced aspects, I leave the basics to the Matlab documentation and other forums/blogs. If you&#039;re still having problems with this, you could either post a question on the &lt;a href=&quot;https://www.mathworks.com/matlabcentral/answers/&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;Matlab Answers&lt;/a&gt; forum, or contact me offline for a private consulting session.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/customizing-axes-rulers#comment-433363">vaishta</a>.</p>
<p>@Vaishta &#8211; you have to read the Matlab documentation about how to create GUI callbacks and how to share data between GUI components/callbacks (<a href="https://www.mathworks.com/help/matlab/creating_guis/share-data-among-callbacks.html" target="_blank" rel="nofollow">https://www.mathworks.com/help/matlab/creating_guis/share-data-among-callbacks.html</a>). In general, you need to store the axes handles in a location that is accessible to the callback function (for example, in the button&#8217;s UserData property). It looks like you&#8217;re using GUIDE to create your GUI, and in this case you could also access the axes handles via the <code>handles</code> structure. </p>
<p>I&#8217;m afraid that all this is pretty basic Matlab GUI stuff, which is not the subject of this blog &#8211; this blog specializes on advanced aspects, I leave the basics to the Matlab documentation and other forums/blogs. If you&#8217;re still having problems with this, you could either post a question on the <a href="https://www.mathworks.com/matlabcentral/answers/" target="_blank" rel="nofollow">Matlab Answers</a> forum, or contact me offline for a private consulting session.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: vaishta		</title>
		<link>https://undocumentedmatlab.com/articles/customizing-axes-rulers#comment-433363</link>

		<dc:creator><![CDATA[vaishta]]></dc:creator>
		<pubDate>Wed, 25 Jul 2018 10:51:44 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=5116#comment-433363</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/customizing-axes-rulers#comment-433355&quot;&gt;vaishta&lt;/a&gt;.

I have also tried the 
&lt;pre lang=&quot;matlab&quot;&gt;
set(ax1,&#039;NextPlot&#039;,&#039;replaceall&#039;)
set(ax2,&#039;NextPlot&#039;,&#039;replaceall&#039;)
set(ax3,&#039;NextPlot&#039;,&#039;replaceall&#039;)
&lt;/pre&gt;
in the callback after the plot() function but its of no use ... it still shows the old axes line, ticks and labels.
including the @axes1_DeleteFcn option  in the callback but no use ...]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/customizing-axes-rulers#comment-433355">vaishta</a>.</p>
<p>I have also tried the </p>
<pre lang="matlab">
set(ax1,'NextPlot','replaceall')
set(ax2,'NextPlot','replaceall')
set(ax3,'NextPlot','replaceall')
</pre>
<p>in the callback after the plot() function but its of no use &#8230; it still shows the old axes line, ticks and labels.<br />
including the @axes1_DeleteFcn option  in the callback but no use &#8230;</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: vaishta		</title>
		<link>https://undocumentedmatlab.com/articles/customizing-axes-rulers#comment-433358</link>

		<dc:creator><![CDATA[vaishta]]></dc:creator>
		<pubDate>Wed, 25 Jul 2018 09:40:36 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=5116#comment-433358</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/customizing-axes-rulers#comment-433355&quot;&gt;vaishta&lt;/a&gt;.

Thank you for information. Can you tell how to implement it in pushbutton callback ? 
Because when I use following code 
&lt;pre lang=&quot;matlab&quot;&gt;
ax = ax1; ax = ax2; ax= ax3;
delete(ax1);delete(ax2);delete(ax3) 
...
...
ax1 = axes(...,&#039;Position&#039;,[...])
plot(ax1,...)
ax2 = axes(...,&#039;Position&#039;,[...])
plot(ax2,...)
ax3 = axes(...,&#039;Position&#039;,[...])
plot(ax3,...)
&lt;/pre&gt;
at beginning of callback to delete axes handle 
it throws error undefined function or variable ax1, ax2, ... ax3]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/customizing-axes-rulers#comment-433355">vaishta</a>.</p>
<p>Thank you for information. Can you tell how to implement it in pushbutton callback ?<br />
Because when I use following code </p>
<pre lang="matlab">
ax = ax1; ax = ax2; ax= ax3;
delete(ax1);delete(ax2);delete(ax3) 
...
...
ax1 = axes(...,'Position',[...])
plot(ax1,...)
ax2 = axes(...,'Position',[...])
plot(ax2,...)
ax3 = axes(...,'Position',[...])
plot(ax3,...)
</pre>
<p>at beginning of callback to delete axes handle<br />
it throws error undefined function or variable ax1, ax2, &#8230; ax3</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/customizing-axes-rulers#comment-433357</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Wed, 25 Jul 2018 09:14:37 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=5116#comment-433357</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/customizing-axes-rulers#comment-433355&quot;&gt;vaishta&lt;/a&gt;.

@Vaishta - gca (=&quot;&lt;b&gt;&lt;u&gt;g&lt;/u&gt;&lt;/b&gt;et &lt;b&gt;&lt;u&gt;c&lt;/u&gt;&lt;/b&gt;urrent &lt;b&gt;&lt;u&gt;a&lt;/u&gt;&lt;/b&gt;xes&quot;) only gets updated when you click or create an axes. If you want your button&#039;s callback to refer to a specific axes, which may or may not be the currently-active axes, you should use not gca but the actual axes handle (the output of the &lt;i&gt;&lt;b&gt;axes&lt;/b&gt;&lt;/i&gt; function). Read the Matlab documentation for more information.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/customizing-axes-rulers#comment-433355">vaishta</a>.</p>
<p>@Vaishta &#8211; gca (=&#8221;<b><u>g</u></b>et <b><u>c</u></b>urrent <b><u>a</u></b>xes&#8221;) only gets updated when you click or create an axes. If you want your button&#8217;s callback to refer to a specific axes, which may or may not be the currently-active axes, you should use not gca but the actual axes handle (the output of the <i><b>axes</b></i> function). Read the Matlab documentation for more information.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: vaishta		</title>
		<link>https://undocumentedmatlab.com/articles/customizing-axes-rulers#comment-433355</link>

		<dc:creator><![CDATA[vaishta]]></dc:creator>
		<pubDate>Wed, 25 Jul 2018 09:07:41 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=5116#comment-433355</guid>

					<description><![CDATA[I have a GUI which has few pushbuttons using which I generate plots
1. In one of the pushbutton callback I use the ax = gca and set its position to make plots in at three different positions 
2. In second pushbutton callback I use the ax = gca and set its position to make only one plot i.e at only one position.

However, when I press pushbutton next time, it still retains the old Axis values although it replaces data from plot. It appears very cluttered. This happens every time I use the pushbutton. 
How can I clear the axes and set it fresh so that old axes and its values disappear ?

I have already tried these options below but no use ... it still shows the old axes labels/tick labels etc. 
&lt;pre lang=&quot;matlab&quot;&gt;
ax = gca
delete(ax.Children)
ax.YRuler.Axle.LineStyle = &#039;none&#039;;
ax.XRuler.Axle.LineStyle = &#039;none&#039;;
ax.YRuler.HandleVisibility = &#039;off&#039;;
ax.XRuler.HandleVisibility = &#039;off&#039;;
&lt;/pre&gt;]]></description>
			<content:encoded><![CDATA[<p>I have a GUI which has few pushbuttons using which I generate plots<br />
1. In one of the pushbutton callback I use the ax = gca and set its position to make plots in at three different positions<br />
2. In second pushbutton callback I use the ax = gca and set its position to make only one plot i.e at only one position.</p>
<p>However, when I press pushbutton next time, it still retains the old Axis values although it replaces data from plot. It appears very cluttered. This happens every time I use the pushbutton.<br />
How can I clear the axes and set it fresh so that old axes and its values disappear ?</p>
<p>I have already tried these options below but no use &#8230; it still shows the old axes labels/tick labels etc. </p>
<pre lang="matlab">
ax = gca
delete(ax.Children)
ax.YRuler.Axle.LineStyle = 'none';
ax.XRuler.Axle.LineStyle = 'none';
ax.YRuler.HandleVisibility = 'off';
ax.XRuler.HandleVisibility = 'off';
</pre>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Leo Simon		</title>
		<link>https://undocumentedmatlab.com/articles/customizing-axes-rulers#comment-374165</link>

		<dc:creator><![CDATA[Leo Simon]]></dc:creator>
		<pubDate>Sun, 10 Apr 2016 17:35:41 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=5116#comment-374165</guid>

					<description><![CDATA[YRuler is great, but it would be lots better if one could customize individual elements of arrays like YTickLabel, etc.      For example, I often draw a horizontal line, add the height of the line to YTick, and give the tick a custom label.     What I&#039;d then like to do is highlight my added label with a different color, font, etc.     But it doesn&#039;t appear possible with the current setup.     It seems like this would be a simple thing for matlab to add.    Or is there some other undocumented way that I can do that already??]]></description>
			<content:encoded><![CDATA[<p>YRuler is great, but it would be lots better if one could customize individual elements of arrays like YTickLabel, etc.      For example, I often draw a horizontal line, add the height of the line to YTick, and give the tick a custom label.     What I&#8217;d then like to do is highlight my added label with a different color, font, etc.     But it doesn&#8217;t appear possible with the current setup.     It seems like this would be a simple thing for matlab to add.    Or is there some other undocumented way that I can do that already??</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Customizing axes part 3 – Backdrop &#124; Undocumented Matlab		</title>
		<link>https://undocumentedmatlab.com/articles/customizing-axes-rulers#comment-334911</link>

		<dc:creator><![CDATA[Customizing axes part 3 – Backdrop &#124; Undocumented Matlab]]></dc:creator>
		<pubDate>Thu, 23 Oct 2014 06:38:32 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=5116#comment-334911</guid>

					<description><![CDATA[[...] In the past two weeks I explained how HG2 (in R2014b) enables us to customize the axes rulers, baselines, box and grid-lines in ways that were previously impossible in HG1 (R2014a or earlier). [...]]]></description>
			<content:encoded><![CDATA[<p>[&#8230;] In the past two weeks I explained how HG2 (in R2014b) enables us to customize the axes rulers, baselines, box and grid-lines in ways that were previously impossible in HG1 (R2014a or earlier). [&#8230;]</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/customizing-axes-rulers#comment-334666</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Mon, 20 Oct 2014 19:47:43 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=5116#comment-334666</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/customizing-axes-rulers#comment-334664&quot;&gt;Matthew Dzieciuch&lt;/a&gt;.

As an alternative, try to improve the performance of your scatter plot by either &lt;a href=&quot;http://undocumentedmatlab.com/blog/undocumented-scatter-plot-behavior&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;plotting a vector of 100+ points&lt;/a&gt; (as odd as it may sound, scatter-plotting 80 points is slower than plotting 2x80=160 points!), or &lt;a href=&quot;http://undocumentedmatlab.com/blog/performance-scatter-vs-line&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;use the low-level &lt;i&gt;&lt;b&gt;line&lt;/b&gt;&lt;/i&gt; function rather than &lt;i&gt;&lt;b&gt;scatter&lt;/b&gt;&lt;/i&gt;&lt;/a&gt;.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/customizing-axes-rulers#comment-334664">Matthew Dzieciuch</a>.</p>
<p>As an alternative, try to improve the performance of your scatter plot by either <a href="http://undocumentedmatlab.com/blog/undocumented-scatter-plot-behavior" target="_blank" rel="nofollow">plotting a vector of 100+ points</a> (as odd as it may sound, scatter-plotting 80 points is slower than plotting 2&#215;80=160 points!), or <a href="http://undocumentedmatlab.com/blog/performance-scatter-vs-line" target="_blank" rel="nofollow">use the low-level <i><b>line</b></i> function rather than <i><b>scatter</b></i></a>.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/customizing-axes-rulers#comment-334665</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Mon, 20 Oct 2014 19:41:26 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=5116#comment-334665</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/customizing-axes-rulers#comment-334664&quot;&gt;Matthew Dzieciuch&lt;/a&gt;.

@Matthew - is your 14b using hardware OpenGL? some HG2 performance issues are due to the fact that it uses more advanced OpenGL features than HG1, so what used to run at hardware-acceleration speed on 14a (HG1) may now run at much slower software speed in 14b (HG2). Upgrading the display driver sometimes helps. I &lt;a href=&quot;http://undocumentedmatlab.com/blog/customizing-axes-part-2#performance&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;discussed this last week&lt;/a&gt;.

Of course, upgrading the driver is not an all-encompassing panacea. Performance issues have been an ongoing issue with HG2. I know for a fact that MathWorks are investing a lot of effort to improve this, but it might take another release or two for things to really settle down.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/customizing-axes-rulers#comment-334664">Matthew Dzieciuch</a>.</p>
<p>@Matthew &#8211; is your 14b using hardware OpenGL? some HG2 performance issues are due to the fact that it uses more advanced OpenGL features than HG1, so what used to run at hardware-acceleration speed on 14a (HG1) may now run at much slower software speed in 14b (HG2). Upgrading the display driver sometimes helps. I <a href="http://undocumentedmatlab.com/blog/customizing-axes-part-2#performance" target="_blank" rel="nofollow">discussed this last week</a>.</p>
<p>Of course, upgrading the driver is not an all-encompassing panacea. Performance issues have been an ongoing issue with HG2. I know for a fact that MathWorks are investing a lot of effort to improve this, but it might take another release or two for things to really settle down.</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
