<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/242697</link>
    <title>MATLAB Central Newsreader - Exclude line from plot ledgend</title>
    <description>Feed for thread: Exclude line from plot ledgend</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>Mon, 19 Jan 2009 20:07:02 -0500</pubDate>
      <title>Exclude line from plot ledgend</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/242697#622593</link>
      <author>Sebastian Gatzka</author>
      <description>Hello World.&lt;br&gt;
&lt;br&gt;
I have added a line object to my plot, which is displayed in the legend now.&lt;br&gt;
I have read, that I can suppress the output inside the legend, but havent found a way of doing it by now.&lt;br&gt;
What is the right syntax for it?&lt;br&gt;
&lt;br&gt;
Thanks in advance. S.</description>
    </item>
    <item>
      <pubDate>Tue, 20 Jan 2009 00:15:05 -0500</pubDate>
      <title>Re: Exclude line from plot ledgend</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/242697#622628</link>
      <author>Sadik </author>
      <description>&quot;Sebastian Gatzka&quot; &amp;lt;sebastian.gatzka.NOSPAM@stud.tu-darmstadt.de&amp;gt; wrote in message &amp;lt;gl2mh5$fkt$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Hello World.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I have added a line object to my plot, which is displayed in the legend now.&lt;br&gt;
&amp;gt; I have read, that I can suppress the output inside the legend, but havent found a way of doing it by now.&lt;br&gt;
&amp;gt; What is the right syntax for it?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Thanks in advance. S.&lt;br&gt;
&lt;br&gt;
Hello Sebastian,&lt;br&gt;
&lt;br&gt;
To do that, you need the handle to the legend.&lt;br&gt;
&lt;br&gt;
So, let us say you have 4 such lines plotted on top of each other, and you say:&lt;br&gt;
&lt;br&gt;
legendHandle = legend('line1','line2','line3','line4');&lt;br&gt;
&lt;br&gt;
then, you would like to suppress line4. What you should do is&lt;br&gt;
&lt;br&gt;
legend(legendHandle,'line1','line2','line3')&lt;br&gt;
&lt;br&gt;
Hope this helps.</description>
    </item>
    <item>
      <pubDate>Tue, 20 Jan 2009 18:06:01 -0500</pubDate>
      <title>Re: Exclude line from plot ledgend</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/242697#622801</link>
      <author>Sebastian Gatzka</author>
      <description>Thats it!&lt;br&gt;
Thank you!</description>
    </item>
    <item>
      <pubDate>Wed, 21 Jan 2009 08:31:02 -0500</pubDate>
      <title>Re: Exclude line from plot ledgend</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/242697#622892</link>
      <author>Pekka Kumpulainen</author>
      <description>&quot;Sebastian Gatzka&quot; &amp;lt;sebastian.gatzka.NOSPAM@stud.tu-darmstadt.de&amp;gt; wrote in message &amp;lt;gl53q9$ir5$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Thats it!&lt;br&gt;
&amp;gt; Thank you!&lt;br&gt;
&lt;br&gt;
That works if you want to drop the last one. It will only change the labels but keeps the linestyles and colors of the first 3 lines.&lt;br&gt;
You can use the line handles to control which you want in the legend. &lt;br&gt;
Say you have an array hl containing the line handles (hl = plot(mydata))&lt;br&gt;
then legend(hl([1 3 4]),'Line1','Line3','Line4') will use the right lines in the legend.&lt;br&gt;
If you need to tweak then a lot it might be easier to set the DisplayName property of the line objects and you don't need to type the texts in each call to legend.</description>
    </item>
  </channel>
</rss>

