<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/240717</link>
    <title>MATLAB Central Newsreader - Set legend regardless of plot</title>
    <description>Feed for thread: Set legend regardless of plot</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>Tue, 09 Dec 2008 15:00:19 -0500</pubDate>
      <title>Set legend regardless of plot</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/240717#615930</link>
      <author>Chris </author>
      <description>Hi,&lt;br&gt;
I'm having trouble setting my legend correctly. I have 3 sets of data plotted in a for loop which plot mulitple lines each. I want a single line in the legend with a corresponding colour not an entry for each line.&lt;br&gt;
&lt;br&gt;
The line my books and searches on the internet have suggested is:&lt;br&gt;
legend('-b','Ganymede','-g','Callisto','-k','Europa');&lt;br&gt;
&lt;br&gt;
but this displays six legend entrys - all of the same colour as the first 6 lines calculated in the loop. Hopefully I'm missing something silly!&lt;br&gt;
&lt;br&gt;
Cheers,&lt;br&gt;
Chris</description>
    </item>
    <item>
      <pubDate>Tue, 09 Dec 2008 16:39:34 -0500</pubDate>
      <title>Re: Set legend regardless of plot</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/240717#615949</link>
      <author>Srikanth</author>
      <description>On Dec 9, 8:00=A0am, &quot;Chris &quot; &amp;lt;chris.craws...@gmail.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; Hi,&lt;br&gt;
&amp;gt; I'm having trouble setting my legend correctly. I have 3 sets of data plo=&lt;br&gt;
tted in a for loop which plot mulitple lines each. I want a single line in =&lt;br&gt;
the legend with a corresponding colour not an entry for each line.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; The line my books and searches on the internet have suggested is:&lt;br&gt;
&amp;gt; legend('-b','Ganymede','-g','Callisto','-k','Europa');&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; but this displays six legend entrys - all of the same colour as the first=&lt;br&gt;
&amp;nbsp;6 lines calculated in the loop. Hopefully I'm missing something silly!&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Cheers,&lt;br&gt;
&amp;gt; Chris&lt;br&gt;
&lt;br&gt;
Try getting a handle for the line(s) you want a legend(s) for - if&lt;br&gt;
there are more than one, just store them in a array and then use those&lt;br&gt;
handles to display your legend</description>
    </item>
    <item>
      <pubDate>Tue, 09 Dec 2008 19:48:03 -0500</pubDate>
      <title>Re: Set legend regardless of plot</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/240717#616000</link>
      <author>Chris </author>
      <description>Srikanth &amp;lt;skt@xdtech.com&amp;gt; wrote in message &amp;lt;bd617f21-3b2b-44f3-bc82-c49d76775871@f40g2000pri.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; On Dec 9, 8:00=A0am, &quot;Chris &quot; &amp;lt;chris.craws...@gmail.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; &amp;gt; Hi,&lt;br&gt;
&amp;gt; &amp;gt; I'm having trouble setting my legend correctly. I have 3 sets of data plo=&lt;br&gt;
&amp;gt; tted in a for loop which plot mulitple lines each. I want a single line in =&lt;br&gt;
&amp;gt; the legend with a corresponding colour not an entry for each line.&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; The line my books and searches on the internet have suggested is:&lt;br&gt;
&amp;gt; &amp;gt; legend('-b','Ganymede','-g','Callisto','-k','Europa');&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; but this displays six legend entrys - all of the same colour as the first=&lt;br&gt;
&amp;gt;  6 lines calculated in the loop. Hopefully I'm missing something silly!&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Cheers,&lt;br&gt;
&amp;gt; &amp;gt; Chris&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Try getting a handle for the line(s) you want a legend(s) for - if&lt;br&gt;
&amp;gt; there are more than one, just store them in a array and then use those&lt;br&gt;
&amp;gt; handles to display your legend&lt;br&gt;
&lt;br&gt;
I'm sorry, I don't understand that - do you mean create a name for each line on the graph and select lines 1, 11, 21 to be on the legend?&lt;br&gt;
&lt;br&gt;
Here is part of the script - is there somewhere I can load up the whole thing, or is it okay to paste it here?&lt;br&gt;
&lt;br&gt;
col=['b';'g';'k'];&lt;br&gt;
for i=1:3&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;for Vinf=Vmin:5e2:Vmax; %V_infinity (m/s)&lt;br&gt;
figure(1);&lt;br&gt;
plot(rP,P,col(i));&lt;br&gt;
legend('-b','Ganymede','-g','Callisto','-k','Europa');&lt;br&gt;
hold on;&lt;br&gt;
end&lt;br&gt;
end&lt;br&gt;
hold off</description>
    </item>
    <item>
      <pubDate>Wed, 10 Dec 2008 06:35:02 -0500</pubDate>
      <title>Re: Set legend regardless of plot</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/240717#616105</link>
      <author>Johan Carlson</author>
      <description>Srikanth &amp;lt;skt@xdtech.com&amp;gt; wrote in message &amp;lt;bd617f21-3b2b-44f3-bc82-c49d76775871@f40g2000pri.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; On Dec 9, 8:00=A0am, &quot;Chris &quot; &amp;lt;chris.craws...@gmail.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; &amp;gt; Hi,&lt;br&gt;
&amp;gt; &amp;gt; I'm having trouble setting my legend correctly. I have 3 sets of data plo=&lt;br&gt;
&amp;gt; tted in a for loop which plot mulitple lines each. I want a single line in =&lt;br&gt;
&amp;gt; the legend with a corresponding colour not an entry for each line.&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; The line my books and searches on the internet have suggested is:&lt;br&gt;
&amp;gt; &amp;gt; legend('-b','Ganymede','-g','Callisto','-k','Europa');&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; but this displays six legend entrys - all of the same colour as the first=&lt;br&gt;
&amp;gt;  6 lines calculated in the loop. Hopefully I'm missing something silly!&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Cheers,&lt;br&gt;
&amp;gt; &amp;gt; Chris&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Try getting a handle for the line(s) you want a legend(s) for - if&lt;br&gt;
&amp;gt; there are more than one, just store them in a array and then use those&lt;br&gt;
&amp;gt; handles to display your legend&lt;br&gt;
&lt;br&gt;
You might be able to use this function (legendlinestyles)&lt;br&gt;
&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/22116&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/22116&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
/JC</description>
    </item>
  </channel>
</rss>

