<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/254093</link>
    <title>MATLAB Central Newsreader - Automatically position annotation on bar graph</title>
    <description>Feed for thread: Automatically position annotation on bar graph</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Thu, 18 Jun 2009 20:15:04 -0400</pubDate>
      <title>Automatically position annotation on bar graph</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/254093#658579</link>
      <author>Gunny </author>
      <description>I could to with some help.&lt;br&gt;
I have created a function which creates a number of subplots based on a user selection.  &lt;br&gt;
The subplots are bar graphs. &lt;br&gt;
The y axis is normalised data.  &lt;br&gt;
The x-axis is is the observations. &lt;br&gt;
I would like to place a text box with the absolute vaue on top of each bar graph.&lt;br&gt;
&lt;br&gt;
Because the bar gaphs are varying height I don't know how to calculate the position of the textbox.  Once the position is calculate how do code the reference to the absolute value to put in the text box?&lt;br&gt;
Below is the code to generate the subplots.&lt;br&gt;
&lt;br&gt;
for i=1:NPlotsWanted&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;subplot(x,y,i),bar(cell2mat(store(2:end-1,ave_index(i)+1))); &lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;xlabel('Month','fontsize',8);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ylabel('Normalised DTC count per month','fontsize',8);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;axis([0 noOfDatas+1 0 0.05]);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;legend(store(1,ave_index(i)+1),'location','NorthOutside','FontSize',8); &lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;set(gca,'XTickLabel', months); % labels Xticks with months.&lt;br&gt;
&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
Thanks, Gunny</description>
    </item>
    <item>
      <pubDate>Fri, 19 Jun 2009 08:56:44 -0400</pubDate>
      <title>Re: Automatically position annotation on bar graph</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/254093#658695</link>
      <author>vedenev</author>
      <description>Use text function. Aslo you can get bar object hendle. See example:&lt;br&gt;
&lt;br&gt;
h=bar([1 2 3]);&lt;br&gt;
x=get(h,'Xdata');&lt;br&gt;
y=get(h,'Ydata');&lt;br&gt;
for xc=1:length(x)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;text(x,y+0.2,['y=' num2str(y)]);&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
---------------------------------------------&lt;br&gt;
Physics teacher toolbox for Matlab project:&lt;br&gt;
&lt;a href=&quot;http://physics-toolbox.tripod.com/&quot;&gt;http://physics-toolbox.tripod.com/&lt;/a&gt;&lt;br&gt;
vedenev@ngs.ru</description>
    </item>
  </channel>
</rss>

