<?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: Colors for Your Multi-Line Plots</title>
	<atom:link href="http://blogs.mathworks.com/pick/2008/08/15/colors-for-your-multi-line-plots/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.mathworks.com/pick/2008/08/15/colors-for-your-multi-line-plots/</link>
	<description>&#60;a href=&#34;http://www.mathworks.com/matlabcentral/fileexchange/loadAuthor.do?objectId=1093599&#38;objectType=author&#34;&#62;Brett&#60;/a&#62; &#38; &#60;a href=&#34;http://www.mathworks.com/matlabcentral/fileexchange/loadAuthor.do?objectId=1094142&#38;objectType=author&#34;&#62;Jiro&#60;/a&#62; share favorite user-contributed submissions from the File Exchange.</description>
	<lastBuildDate>Fri, 10 Feb 2012 16:12:39 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: dp</title>
		<link>http://blogs.mathworks.com/pick/2008/08/15/colors-for-your-multi-line-plots/#comment-14405</link>
		<dc:creator>dp</dc:creator>
		<pubDate>Mon, 30 Jan 2012 10:25:10 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/08/15/colors-for-your-multi-line-plots/#comment-14405</guid>
		<description>Thanks very much</description>
		<content:encoded><![CDATA[<p>Thanks very much</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jacob</title>
		<link>http://blogs.mathworks.com/pick/2008/08/15/colors-for-your-multi-line-plots/#comment-14359</link>
		<dc:creator>Jacob</dc:creator>
		<pubDate>Thu, 08 Dec 2011 22:01:48 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/08/15/colors-for-your-multi-line-plots/#comment-14359</guid>
		<description>Hello,

How do you call out the colors from the color map and apply them to individual plots?

For example, say I wanted to use color 10 from the colorbar generated from the code below. How could I put it in my plot command? Is it done just like calling out the default colors?

I know I could just use one of the default colors but I have 12 plots that require different colors for my project. 



NumberOfPlots=12;
 
          ColorSet=varycolor(NumberOfPlots);
  
          figure
          hold on;
  
          for m=1:NumberOfPlots
              plot(ones(20,1)*m,&#039;Color&#039;,ColorSet(m,:))
          end
set(gcf, &#039;Colormap&#039;, ColorSet);
colorbar

plot(x,y,&#039;?&#039;)
</description>
		<content:encoded><![CDATA[<p>Hello,</p>
<p>How do you call out the colors from the color map and apply them to individual plots?</p>
<p>For example, say I wanted to use color 10 from the colorbar generated from the code below. How could I put it in my plot command? Is it done just like calling out the default colors?</p>
<p>I know I could just use one of the default colors but I have 12 plots that require different colors for my project. </p>
<p>NumberOfPlots=12;</p>
<p>          ColorSet=varycolor(NumberOfPlots);</p>
<p>          figure<br />
          hold on;</p>
<p>          for m=1:NumberOfPlots<br />
              plot(ones(20,1)*m,&#8217;Color&#8217;,ColorSet(m,:))<br />
          end<br />
set(gcf, &#8216;Colormap&#8217;, ColorSet);<br />
colorbar</p>
<p>plot(x,y,&#8217;?')</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: naga</title>
		<link>http://blogs.mathworks.com/pick/2008/08/15/colors-for-your-multi-line-plots/#comment-14303</link>
		<dc:creator>naga</dc:creator>
		<pubDate>Mon, 07 Nov 2011 14:04:58 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/08/15/colors-for-your-multi-line-plots/#comment-14303</guid>
		<description>sorry...just now i downloaded. it works grate......

thank you very much</description>
		<content:encoded><![CDATA[<p>sorry&#8230;just now i downloaded. it works grate&#8230;&#8230;</p>
<p>thank you very much</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jiro</title>
		<link>http://blogs.mathworks.com/pick/2008/08/15/colors-for-your-multi-line-plots/#comment-14302</link>
		<dc:creator>jiro</dc:creator>
		<pubDate>Sun, 06 Nov 2011 23:16:18 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/08/15/colors-for-your-multi-line-plots/#comment-14302</guid>
		<description>@naga,

Did you download “varycolor” from the File Exchange? Also, make sure that you put the function at a location where MATLAB can find it. Read about it &lt;a href=&quot;http://www.mathworks.com/help/techdoc/matlab_env/br5tea6-6.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.</description>
		<content:encoded><![CDATA[<p>@naga,</p>
<p>Did you download “varycolor” from the File Exchange? Also, make sure that you put the function at a location where MATLAB can find it. Read about it <a href="http://www.mathworks.com/help/techdoc/matlab_env/br5tea6-6.html" rel="nofollow">here</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: naga</title>
		<link>http://blogs.mathworks.com/pick/2008/08/15/colors-for-your-multi-line-plots/#comment-14299</link>
		<dc:creator>naga</dc:creator>
		<pubDate>Sat, 05 Nov 2011 14:57:27 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/08/15/colors-for-your-multi-line-plots/#comment-14299</guid>
		<description>hi i am using like this please help me:

i have a cell array z{k}, i want to plot it with different colours, i tried ur code, but its not working please help me. 

ColorSet = varycolor(280);


set(gca, &#039;ColorOrder&#039;, ColorSet);
plot(z{k})
hold on

when i tried this, i am getting error like this

??? Undefined function or method &#039;varycolor&#039; for input
arguments of type &#039;double&#039;.</description>
		<content:encoded><![CDATA[<p>hi i am using like this please help me:</p>
<p>i have a cell array z{k}, i want to plot it with different colours, i tried ur code, but its not working please help me. </p>
<p>ColorSet = varycolor(280);</p>
<p>set(gca, &#8216;ColorOrder&#8217;, ColorSet);<br />
plot(z{k})<br />
hold on</p>
<p>when i tried this, i am getting error like this</p>
<p>??? Undefined function or method &#8216;varycolor&#8217; for input<br />
arguments of type &#8216;double&#8217;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott Otterson</title>
		<link>http://blogs.mathworks.com/pick/2008/08/15/colors-for-your-multi-line-plots/#comment-14280</link>
		<dc:creator>Scott Otterson</dc:creator>
		<pubDate>Fri, 21 Oct 2011 14:26:02 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/08/15/colors-for-your-multi-line-plots/#comment-14280</guid>
		<description>Markus:  Thanks!  I&#039;m using this.

Geoffrey: I haven&#039;t seen your code but my guess is that you&#039;re setting the color order and then calling plot().  

The problem with this is that plot() resets the ColorOrder property.  You can prevent that by preceding plot() with a command that freezes ColorOrder.  Either like this:

&lt;pre&gt;
  set(gca, &#039;ColorOrder&#039;, colororder);
  hold on
  plot(...)
&lt;/pre&gt;
&lt;/b&gt;

or like this:

&lt;pre&gt;
  set(gca, &#039;ColorOrder&#039;, colororder);
  set(gca,&#039;NextPlot&#039;,&#039;replacechildren&#039;)
  plot(...)
&lt;/pre&gt;
&lt;/b&gt;</description>
		<content:encoded><![CDATA[<p>Markus:  Thanks!  I&#8217;m using this.</p>
<p>Geoffrey: I haven&#8217;t seen your code but my guess is that you&#8217;re setting the color order and then calling plot().  </p>
<p>The problem with this is that plot() resets the ColorOrder property.  You can prevent that by preceding plot() with a command that freezes ColorOrder.  Either like this:</p>
<pre>
  set(gca, 'ColorOrder', colororder);
  hold on
  plot(...)
</pre>
<p></p>
<p>or like this:</p>
<pre>
  set(gca, 'ColorOrder', colororder);
  set(gca,'NextPlot','replacechildren')
  plot(...)
</pre>
<p></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Geoffrey</title>
		<link>http://blogs.mathworks.com/pick/2008/08/15/colors-for-your-multi-line-plots/#comment-14025</link>
		<dc:creator>Geoffrey</dc:creator>
		<pubDate>Fri, 18 Feb 2011 10:55:26 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/08/15/colors-for-your-multi-line-plots/#comment-14025</guid>
		<description>This coding could help me but when I choose 8 lines and then I try to insert a legend I get 50 data lines with the 8 colors repeating. How can I get a legend with just my 8 lines. I don&#039;t know if you have ran into this problem.

thanks</description>
		<content:encoded><![CDATA[<p>This coding could help me but when I choose 8 lines and then I try to insert a legend I get 50 data lines with the 8 colors repeating. How can I get a legend with just my 8 lines. I don&#8217;t know if you have ran into this problem.</p>
<p>thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: oni</title>
		<link>http://blogs.mathworks.com/pick/2008/08/15/colors-for-your-multi-line-plots/#comment-13565</link>
		<dc:creator>oni</dc:creator>
		<pubDate>Tue, 18 May 2010 21:38:47 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/08/15/colors-for-your-multi-line-plots/#comment-13565</guid>
		<description>thanks!! I am using your code to change colors for lines AND markers :-D</description>
		<content:encoded><![CDATA[<p>thanks!! I am using your code to change colors for lines AND markers :-D</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Markus</title>
		<link>http://blogs.mathworks.com/pick/2008/08/15/colors-for-your-multi-line-plots/#comment-12842</link>
		<dc:creator>Markus</dc:creator>
		<pubDate>Sun, 14 Sep 2008 18:05:16 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/08/15/colors-for-your-multi-line-plots/#comment-12842</guid>
		<description>Hi Doug, 

long ago I fiddled out a number of distinguishable colors by hand. You find them in this matrix:

&lt;pre&gt; &lt;code&gt;
colororder = [
	0.00  0.00  1.00
	0.00  0.50  0.00 
	1.00  0.00  0.00 
	0.00  0.75  0.75
	0.75  0.00  0.75
	0.75  0.75  0.00 
	0.25  0.25  0.25
	0.75  0.25  0.25
	0.95  0.95  0.00 
	0.25  0.25  0.75
	0.75  0.75  0.75
	0.00  1.00  0.00 
	0.76  0.57  0.17
	0.54  0.63  0.22
	0.34  0.57  0.92
	1.00  0.10  0.60
	0.88  0.75  0.73
	0.10  0.49  0.47
	0.66  0.34  0.65
	0.99  0.41  0.23
];
&lt;/pre&gt;&lt;/code&gt;

Since then, setting the default color order is in my Matlab startup file.

Another good way to find distinguishable colors is to use the color spiral of James McNames: http://bsp.pdx.edu/Software/

Yours
Markus</description>
		<content:encoded><![CDATA[<p>Hi Doug, </p>
<p>long ago I fiddled out a number of distinguishable colors by hand. You find them in this matrix:</p>
<pre> <code>
colororder = [
	0.00  0.00  1.00
	0.00  0.50  0.00
	1.00  0.00  0.00
	0.00  0.75  0.75
	0.75  0.00  0.75
	0.75  0.75  0.00
	0.25  0.25  0.25
	0.75  0.25  0.25
	0.95  0.95  0.00
	0.25  0.25  0.75
	0.75  0.75  0.75
	0.00  1.00  0.00
	0.76  0.57  0.17
	0.54  0.63  0.22
	0.34  0.57  0.92
	1.00  0.10  0.60
	0.88  0.75  0.73
	0.10  0.49  0.47
	0.66  0.34  0.65
	0.99  0.41  0.23
];
</code></pre>
<p></p>
<p>Since then, setting the default color order is in my Matlab startup file.</p>
<p>Another good way to find distinguishable colors is to use the color spiral of James McNames: <a href="http://bsp.pdx.edu/Software/" rel="nofollow">http://bsp.pdx.edu/Software/</a></p>
<p>Yours<br />
Markus</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul Mennen</title>
		<link>http://blogs.mathworks.com/pick/2008/08/15/colors-for-your-multi-line-plots/#comment-12460</link>
		<dc:creator>Paul Mennen</dc:creator>
		<pubDate>Sun, 17 Aug 2008 00:12:04 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/08/15/colors-for-your-multi-line-plots/#comment-12460</guid>
		<description>&gt; When I have this many lines, I often wonder what
&gt; the best way to put a legend is.

Yes I agree that the usual Matlab legend is not practical with many traces (such as 50 as in your example). The color
matrix is a clever alternative. However if you really need to identify the individual traces by name, that doesn&#039;t help.

There is yet another alternative for this problem that you may not be aware of. It is to use &quot;plt&quot; an alternative to matlab&#039;s &quot;plot&quot; and &quot;plotyy&quot; that you will find on the file exchange at:

http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=4936&amp;objectType=file

(or just search for &quot;plt&quot;.)

If you run the demo program &quot;demo\pltn.m&quot; you will see a plot with 99 traces, each one with a unique name and a unique color!

While identifying all 99 traces by color alone is a tall order, most people can distinguish at least the first 30 traces or so by color. One advantage of this legend style (besides being compact enough to be practical) is that if you can&#039;t tell which trace is which based on color alone, just click on the legend entry and the trace will toggle, making it immediately obvious.

Although you can tell plt to use Matlab&#039;s default color scheme, or to use colors generated by VARYCOLOR, I&#039;ve found that the problem of identifying more than about 10 traces using color is much easier when a black (or very dark) background is used for the plotting area. Although this is shocking at first, the advantages become more clear once you get used to it. (This is the default with plt). I think the reason for this is that you can maximize color saturation and plot contrast at the same time. The situation on paper (hardcopy) is reversed, I believe because of the distinction between emitted and reflected light.

If you do get a chance to try out plt, I encourage you to run &quot;demo\demoplt.m&quot; and also to peruse the extensive documentation (plt.chm). If you have any questions or comments about it, I&#039;m all ears.

~Paul</description>
		<content:encoded><![CDATA[<p>&gt; When I have this many lines, I often wonder what<br />
&gt; the best way to put a legend is.</p>
<p>Yes I agree that the usual Matlab legend is not practical with many traces (such as 50 as in your example). The color<br />
matrix is a clever alternative. However if you really need to identify the individual traces by name, that doesn&#8217;t help.</p>
<p>There is yet another alternative for this problem that you may not be aware of. It is to use &#8220;plt&#8221; an alternative to matlab&#8217;s &#8220;plot&#8221; and &#8220;plotyy&#8221; that you will find on the file exchange at:</p>
<p><a href="http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=4936&#038;objectType=file" rel="nofollow">http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=4936&#038;objectType=file</a></p>
<p>(or just search for &#8220;plt&#8221;.)</p>
<p>If you run the demo program &#8220;demo\pltn.m&#8221; you will see a plot with 99 traces, each one with a unique name and a unique color!</p>
<p>While identifying all 99 traces by color alone is a tall order, most people can distinguish at least the first 30 traces or so by color. One advantage of this legend style (besides being compact enough to be practical) is that if you can&#8217;t tell which trace is which based on color alone, just click on the legend entry and the trace will toggle, making it immediately obvious.</p>
<p>Although you can tell plt to use Matlab&#8217;s default color scheme, or to use colors generated by VARYCOLOR, I&#8217;ve found that the problem of identifying more than about 10 traces using color is much easier when a black (or very dark) background is used for the plotting area. Although this is shocking at first, the advantages become more clear once you get used to it. (This is the default with plt). I think the reason for this is that you can maximize color saturation and plot contrast at the same time. The situation on paper (hardcopy) is reversed, I believe because of the distinction between emitted and reflected light.</p>
<p>If you do get a chance to try out plt, I encourage you to run &#8220;demo\demoplt.m&#8221; and also to peruse the extensive documentation (plt.chm). If you have any questions or comments about it, I&#8217;m all ears.</p>
<p>~Paul</p>
]]></content:encoded>
	</item>
</channel>
</rss>

