<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:series="http://unfoldingneurons.com/"
	>

<channel>
	<title>vis4.net &#187; color</title>
	<atom:link href="http://vis4.net/blog/tags/color/feed/" rel="self" type="application/rss+xml" />
	<link>http://vis4.net</link>
	<description>The geeky side of information visualization</description>
	<lastBuildDate>Thu, 12 Jan 2012 22:59:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>How To Avoid Equidistant HSV Colors</title>
		<link>http://vis4.net/blog/posts/avoid-equidistant-hsv-colors/?piwik_campaign=rss&#038;piwik_kwd=3199</link>
		<comments>http://vis4.net/blog/posts/avoid-equidistant-hsv-colors/?piwik_campaign=rss&#038;piwik_kwd=3199#comments</comments>
		<pubDate>Tue, 13 Dec 2011 13:35:25 +0000</pubDate>
		<dc:creator>Gregor Aisch</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[color]]></category>
		<category><![CDATA[featured]]></category>

		<guid isPermaLink="false">http://vis4.net/blog/?p=3199</guid>
		<description><![CDATA[As some of you pointed out in the comments of my last post, taking equidistant colors in the HSV color space is no solution for finding a set of colors that are perceived as equidistant. This post describes what's wrong with HSV and what we can do about this. Note that since this post contains [...]]]></description>
			<content:encoded><![CDATA[<p>As some of you pointed out in the comments of my last post, taking equidistant colors in the HSV color space is no solution for finding a set of colors that are <em>perceived</em> as equidistant. This post describes what's wrong with HSV and what we can do about this. Note that since this post contains interactive elements built on the latest web technologies, you might need a <a href="https://www.google.com/chrome">modern</a> <a href="http://www.mozilla.org/firefox/">browser</a> to get the most out of it.<br />
<span id="more-3199"></span></p>
<h2>What's so wrong with HSV?</h2>
<p>Well, the main problem is that the <strong>value</strong> component of HSV is just a measure for the <em>physical lightness</em> of color, but not for the <em>perceived brightness</em>. Thus, fully saturated yellow has the same "value" as blue. The same is true for the HSL color space. Here is a set of six colors of the same <em>value</em> to demonstrate this effect. The second row shows how the colors look after converting to grayscale via Photoshop.</p>
<p><img class="aligncenter size-full wp-image-3218" title="equivalue-hsv" src="http://vis4.net/blog/wp-content/uploads/2011/12/equivalue-hsv.png" alt="" width="306" height="51" /></p>
<p><img class="aligncenter size-full wp-image-3219" title="equivalue-hsv-grayscale" src="http://vis4.net/blog/wp-content/uploads/2011/12/equivalue-hsv-grayscale.png" alt="" width="306" height="51" /></p>
<p>Beside of this strong <em>hue-dependency</em> of brightness, there is also no linear brightness gradient within a single hue. For instance, in the following HSL color scale the brightness step between the second and the third red appears much bigger than the step between the 3th and 4th color. Even worse, this effect seems to differ across different hues, as the comparison to the blue scale shows.</p>
<p><img class="aligncenter size-full wp-image-3220" title="hsv-reds" src="http://vis4.net/blog/wp-content/uploads/2011/12/hsv-reds.png" alt="" width="309" height="53" /></p>
<p><img class="aligncenter size-full wp-image-3221" title="Bildschirmfoto 2011-12-12 um 22.35.07" src="http://vis4.net/blog/wp-content/uploads/2011/12/Bildschirmfoto-2011-12-12-um-22.35.07.png" alt="" width="309" height="54" /></p>
<p>After all, this should be enough reason to avoid equidistant HSV/HSL scales. But what options do we have instead?</p>
<h2>For the lazy ones: Use ColorBrewer</h2>
<p>So the question is, what shall we do about it? In the comments someone mentioned <a href="http://colorbrewer2.com/">ColorBrewer</a>, which is in fact a great solution for those who just want to get some colors without caring too much about the details. Here's a selection of sequential ColorBrewer scales.</p>
<p><img class="aligncenter size-full wp-image-3223" title="colorbrewer-scales" src="http://vis4.net/blog/wp-content/uploads/2011/12/Bildschirmfoto-2011-12-12-um-22.57.54.png" alt="" width="312" height="278" /></p>
<p>One drawback of this solution is that you're limited to a fixed number of colors. For each color scale, the collection gives you variants from 3 to 9 colors. Another drawback is that sticking to a predefined set of colors means giving away some artistic freedom. Also, and most importantly, it's not half as fun to pick existing solutions, isn't it?</p>
<h2>For the color geeks: Make friends with CIE L*a*b*</h2>
<p>At this point, you better prepare yourself for some ultimate color geekyness. Thanks to the <a href="http://davidad.net/colorviz/">gentle introduction of David Dalrymple</a>, I finally dared to enter the magic world of the <strong>CIE L*a*b*</strong> color space. To get a better understanding of this color model, I ported David's code to JavaScript and built a tiny Lab color selector. The vertical slider allows you to navigate through the space. Also you can change the x and y axis using the links next to the slider.</p>
<p><iframe style="border: 0pt none;" src="http://vis4.net/labs/colorvis/embed.html?m=lab" width="522" height="475"></iframe></p>
<p>In general, the<a href="http://en.wikipedia.org/wiki/Lab_color_space"> Lab color space</a> has one component for <strong>L</strong>ightness and two bipolar color components <strong>a</strong> (yellow-blue) and <strong>b</strong> (green-magenta). While the lightness ranges from 0% to 100%, determining the valid ranges for <em>a</em> and <em>b</em> is somewhat tricky.</p>
<p>The problem is that CIE L*a*b* contains more colors than are available in RGB. For instance, the "valid" range for <em>a</em> depends on the lightness and the second color channel. Another problem is that it's hard to select colors by mixing four colors. To get around those issues, David Dalrymple suggests a fancy transformation of the Lab space.</p>
<h2>CSL: Making CIE Lab more accessible</h2>
<p>The trick is easy. You use the <strong>a</strong> and <strong>b</strong> components to compute a color angle (hue) and a radius (saturation). Because it's not exactly the same as hue in HSV, it's named <strong>c</strong> (for chroma). Basically this gives this us the CSL color space (although I'm not sure how this is named in vis science).</p>
<p><iframe style="border: 0pt none;" src="http://vis4.net/labs/colorvis/embed.html?m=csl" width="522" height="475"></iframe></p>
<p>While the problem of non-existent colors still remains (especially if you increase saturation) this looks like something we can start to work with. For instance, if we take a look at equidistant CSL colors of the same lightness we get a much better result. Actually, if you'd convert this into grayscale again you get the exact gray value for all colors. Well, this is no big surprise, I bet Photoshop itself uses CIE L*a*b* for grayscale conversions.</p>
<p><img class="aligncenter" title="csl-equidistant" src="http://vis4.net/blog/wp-content/uploads/2011/12/csl-equidistant.png" alt="CSL" width="309" height="54" /></p>
<h2>Now, let's grab some colors..</h2>
<p>This is where the fun begins, so I'm glad you made it up to here. To learn more about the difference of equidistant colors across color spaces, I visualized the linear gradient in the color selector. Feel free to experiment with them and check how the <a href="http://vis4.net/labs/colorvis/embed.html?m=csl&amp;gradients=6" target="colpick">CSL</a> color space compares to other spaces like <a href="http://vis4.net/labs/colorvis/embed.html?m=lab&amp;gradients=6" target="colpick">LAB</a>, <a href="http://vis4.net/labs/colorvis/embed.html?m=hsv&amp;gradients=6" target="colpick">HSV</a>, <a href="http://vis4.net/labs/colorvis/embed.html?m=hsl&amp;gradients=6" target="colpick">HSL</a><!--, <a href="http://vis4.net/labs/colorvis/embed.html?m=hsi&amp;gradients=6" target="colpick">HSI--> or <a href="http://vis4.net/labs/colorvis/embed.html?m=rgb&amp;gradients=6" target="colpick">RGB</a>.</p>
<p><iframe style="border: 0pt none;" name="colpick" src="http://vis4.net/labs/colorvis/embed.html?m=csl&amp;gradients=6" width="522" height="532"></iframe></p>
<p><script type="text/javascript">// < ![CDATA[
// < ![CDATA[
 var c0, c1; function pUpdateGradient(fcol, tcol) { c0 = fcol; c1 = tcol; updateGradientFrame();         } function updateGradientFrame() {    if (frames['interpol'].setGradient != undefined)           frames['interpol'].setGradient(c0, c1);    else setTimeout(updateGradientFrame, 400); }
// ]]&gt;</script></p>
<p>Also, it's interesting to directly compare the interpolated colors across different color spaces:</p>
<p><iframe id="interpol" style="border: 0pt none;" name="interpol" src="http://vis4.net/labs/colorvis/interpolate.html" width="500" height="342"></iframe></p>
<h2>Nice! How do I get those colors?</h2>
<p>To make things easy, I packed everything up in a small JavaScript library named <a href="https://github.com/gka/chroma.js">chroma.js</a>. It has a simple yet powerful API,check out the <a href="https://github.com/gka/chroma.js">Github repository</a> to learn more. Since this is still in early beta phase, l'd appreciate if you <a href="https://github.com/gka/chroma.js/issues/new">document bugs</a> you may encounter.</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="javascript"><pre class="de1"><span class="co1">// most simple interpolation in CSL space</span>
chroma.<span class="me1">interpolate</span><span class="br0">&#40;</span><span class="st0">&quot;#383D41&quot;</span><span class="sy0">,</span> <span class="st0">&quot;#EFEE69&quot;</span><span class="sy0">,</span> <span class="nu0">0.5</span><span class="sy0">,</span> <span class="st0">'csl'</span><span class="br0">&#41;</span>.<span class="me1">hex</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span> 
<span class="co1">// returns &quot;#5C9A7C&quot;</span>
&nbsp;
<span class="co1">// also, you can instantiate CSL colors directly </span>
chroma.<span class="me1">csl</span><span class="br0">&#40;</span><span class="nu0">60</span><span class="sy0">,</span> .7<span class="sy0">,</span> <span class="nu0">1</span><span class="br0">&#41;</span>.<span class="me1">hex</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="co1">// returns &quot;#C6A860&quot;</span></pre></div></div></div></div></div></div></div>


]]></content:encoded>
			<wfw:commentRss>http://vis4.net/blog/posts/avoid-equidistant-hsv-colors/?piwik_campaign=rss&#038;piwik_kwd=3199/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Take Care of your Choropleth Maps</title>
		<link>http://vis4.net/blog/posts/choropleth-maps/?piwik_campaign=rss&#038;piwik_kwd=3114</link>
		<comments>http://vis4.net/blog/posts/choropleth-maps/?piwik_campaign=rss&#038;piwik_kwd=3114#comments</comments>
		<pubDate>Thu, 01 Dec 2011 01:33:17 +0000</pubDate>
		<dc:creator>Gregor Aisch</dc:creator>
				<category><![CDATA[cartography]]></category>
		<category><![CDATA[color]]></category>
		<category><![CDATA[criticism]]></category>
		<category><![CDATA[cartogram]]></category>
		<category><![CDATA[choropleth]]></category>
		<category><![CDATA[featured]]></category>
		<category><![CDATA[map]]></category>
		<category><![CDATA[scales]]></category>

		<guid isPermaLink="false">http://vis4.net/blog/posts/choropleth-maps/</guid>
		<description><![CDATA[Over the last week I had some fun playing with choropleth maps. Thereby I analyzed the following US poverty map, which was recently published at the Guardian data blog: To be honest, the first time I saw this map I didn't thought much about it. Ok, poverty is highest in south central of the United [...]]]></description>
			<content:encoded><![CDATA[<p><!--:en-->Over the last week I had some fun playing with choropleth maps. Thereby I analyzed the following US poverty map, which was recently published at the <a href="http://www.guardian.co.uk/news/datablog/interactive/2011/sep/15/us-poverty-mapped">Guardian data blog</a>:</p>
<p><a href="http://www.guardian.co.uk/news/datablog/interactive/2011/sep/15/us-poverty-mapped"><img class="aligncenter size-full wp-image-3115" title="US poverty mapped" src="http://vis4.net/blog/wp-content/uploads/2011/11/fusiontables.png" alt="" width="522" height="312" /></a></p>
<p>To be honest, the first time I saw this map I didn't thought much about it. Ok, poverty is highest in south central of the United States, especially near Mexican border. But recently I used the same data to demonstrate a choropleth map that I created from-scratch and I was really surprised to see a somewhat different picture:</p>
<p><span id="more-3114"></span></p>
<p><img class="aligncenter size-full wp-image-3123" title="map" src="http://vis4.net/blog/wp-content/uploads/2011/11/map.png" alt="" width="521" height="315" /></p>
<p>Naturally, I wanted to know where the differences come from and spent some time to investigate. Actually, I think there are two big fails in the Guardian map (which was made using Google Fusion tables).</p>
<h2>Don't mess around with your class limits</h2>
<p>The values in the poverty data range from 6.6% to 22.7% and the map shows them divided into five classes. If one would compute the exact equidistant class limits between the minimum and maximum value one would come up with the following classes (the gray bar is used to indicate the data range):</p>
<p><img class="aligncenter size-full wp-image-3126" title="limits1" src="http://vis4.net/blog/wp-content/uploads/2011/11/limits1.png" alt="" width="447" height="69" /></p>
<p>I'm not sure if this is the default behaviour of Google Fusion Tables or the editors choice, but the Guardian map used the class limits 6-9%, 9-12%, 12-15%, 15-18% and 18-23%. Due to the round numbers one might think that they are easier to understand than the fractioned numbers above, but this comes at the high price of distorted class distribution:</p>
<p><img class="aligncenter size-full wp-image-3127" title="limits2" src="http://vis4.net/blog/wp-content/uploads/2011/11/limits2.png" alt="" width="461" height="72" /> Note that the fifth class (which shows the poorest states) is blown up while the first class is a bit under-represented. Given the highly political topic, I'd argue that while we're trying to map inequality, we should at least use equally distributed classes.</p>
<h2>Don't mess around with your class colors</h2>
<p>The second big failure of the map is the choice of colors. This colors were used for the Guardian map:</p>
<p><img class="aligncenter size-full wp-image-3120" title="guardian" src="http://vis4.net/blog/wp-content/uploads/2011/11/guardian1.png" alt="" width="522" height="88" /></p>
<p>Obviously there's a large jump between the first and second class and an <em>enormous</em> jump between the fourth and fifth color. The fourth color looks like taken from a completely different gradient and is hardly distinguishable from the third color. Again, I'm not sure if this is some kind of default in Google Fusion tables, but maybe they were just hand-picked.</p>
<p>Instead, in my map I simply used equidistant colors from a HSV gradient:</p>
<p><img class="aligncenter size-full wp-image-3130" title="hsv-colors" src="http://vis4.net/blog/wp-content/uploads/2011/11/hsv-colors.png" alt="" width="522" height="80" /></p>
<p>But, as mentioned in the comments below, even equidistant HSV colors are not the best option. The problem is that humans perception of <a href="http://en.wikipedia.org/wiki/Brightness">brightness</a> differs from the arithmetical <a href="http://en.wikipedia.org/wiki/Lightness_%28color%29">lightness</a> of HSV colors.</p>
<p>To demonstrate this difference, let's compare the equidistant HSV colors to a hand-picked color scale from <a href="http://colorbrewer2.org/index.php?type=sequential&amp;scheme=Reds&amp;n=7">colorbrewer2.org</a>:</p>
<p><img class="aligncenter size-full wp-image-3192" title="equidistant hsv colors" src="http://vis4.net/blog/wp-content/uploads/2011/12/Bildschirmfoto-2011-12-02-um-11.48.05.png" alt="" width="488" height="310" /></p>
<p><img class="aligncenter size-full wp-image-3196" title="color scale by colorbrewer" src="http://vis4.net/blog/wp-content/uploads/2011/12/Bildschirmfoto-2011-12-02-um-12.10.52.png" alt="" width="490" height="303" />Quite a different picture, isn't it?</p>
<h2>And better think twice about your class count</h2>
<p>Another question is why we should use five classes at all. It's kind of interesting to see how "dramatically" the picture changes if one changes the number of classes. Given the fact that we're living in the age of interactive maps that allow us to read data values from tooltips, there's no more reason to be stingy with colors. At least, I think a number of seven classes should be a better trade-of between correctness and color distinguishability.</p>
<p><img class="aligncenter size-full wp-image-3133" title="choropleth-classes" src="http://vis4.net/blog/wp-content/uploads/2011/12/choropleth-classes.gif" alt="" width="514" height="354" /></p>
<h2>Be careful when visualizing non-area-related data using choropleth maps</h2>
<p>At the end I just want to mention another well-known problem of choropleth maps. The visual significance of a particular geographic region depends on the color value multiplied with the area of that region. Thus, a larger but equally colored region appears more important than a smaller one. Especially when you're dealing with non-area related data, like the poverty of human beings, this might cause additional mis-interpretations. One way to get around this is to use cartograms, which aim to resize geographic regions according to a measurement that has more relevance to the context of the data. For instance, in the next image you can see a <em>Dorling cartogram</em> (where circles represent regions) that sizes the states according to 2010 population. This way, we visually relate the poverty rates to the affected population instead of the affected area.<br />
<img class="aligncenter size-full wp-image-3138" title="us state population cartogram" src="http://vis4.net/blog/wp-content/uploads/2011/12/Bildschirmfoto-2011-12-01-um-01.53.59.png" alt="" width="505" height="294" /></p>
<p>So, what to do next? For me, the clear answer is that we need better educated map makers and, perhaps more importantly, we need better open source tools for thematic mapping. That's what I'm kind of working on right now..</p>
<p><em>Update: Jorge Camoes wrote a kind of follow-up post to this one, called <a title="The same data, the same map, different stories" href="http://www.excelcharts.com/blog/the-same-data-the-same-map-different-stories/">The same data, the same map, different stories</a>. Make sure to check it out as well.<br />
</em><!--:--></p>
]]></content:encoded>
			<wfw:commentRss>http://vis4.net/blog/posts/choropleth-maps/?piwik_campaign=rss&#038;piwik_kwd=3114/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Saying Goodbye to Red-Green Color Scales</title>
		<link>http://vis4.net/blog/posts/goodbye-redgreen-scales/?piwik_campaign=rss&#038;piwik_kwd=3098</link>
		<comments>http://vis4.net/blog/posts/goodbye-redgreen-scales/?piwik_campaign=rss&#038;piwik_kwd=3098#comments</comments>
		<pubDate>Thu, 24 Nov 2011 13:59:25 +0000</pubDate>
		<dc:creator>Gregor Aisch</dc:creator>
				<category><![CDATA[color]]></category>
		<category><![CDATA[color blindness]]></category>
		<category><![CDATA[color scales]]></category>
		<category><![CDATA[featured]]></category>

		<guid isPermaLink="false">http://vis4.net/blog/?p=3098</guid>
		<description><![CDATA[I used to love them, but it's over now: diverging red-green color scales. I bet the reason for the popularity of red-green color scales is that they are so easy to interpret (at least in my culture). Green means good, red means bad. For instance, the above map shows the income of private households for [...]]]></description>
			<content:encoded><![CDATA[<p><!--:en-->I used to love them, but it's over now: diverging red-green color scales.</p>
<p><img class="aligncenter size-full wp-image-3100" title="red green scale" src="http://vis4.net/blog/wp-content/uploads/2011/11/redgreen.png" alt="red green scale" width="522" height="440" /></p>
<p>I bet the reason for the popularity of red-green color scales is that they are so easy to interpret (at least in my culture). Green means good, red means bad. For instance, the above map shows the income of private households for European regions. I used a diverging color scale to show the difference from the average income (bright yellow) with higher incomes in green and lower incomes in red. In fact, I picked the exact colors from good old <a href="https://github.com/prefuse/Flare/blob/master/flare/src/flare/util/palette/ColorPalette.as#L160">flare visualization toolkit</a>.</p>
<p>But there's some trouble with this scale. Firstly, as alluded to above, the meaning of red and green vary a lot in different cultures. According to this helpful collection of <a href="http://www.globalization-group.com/edge/resources/color-meanings-by-culture/">Color Meanings By Culture</a>, green is negatively associated in some Eastern cultures like China or Indonesia while red is associated to love, happiness and a long life.</p>
<p><!--:--><span id="more-3098"></span><!--:en-->The second source of trouble comes in if you want to include dichromats aka color blind people in your audience. Here's a simulation of how someone with Deuteranope color blindness (aka <em>green</em> blindness) would see the red-green scale:</p>
<p><img class="aligncenter size-full wp-image-3101" title="red green - deuteranope" src="http://vis4.net/blog/wp-content/uploads/2011/11/redgreen-deut.png" alt="" width="522" height="440" /></p>
<p>Almost the same problem for people with Protanope color blindness (aka <em>red</em> blindness):</p>
<p><img class="aligncenter size-full wp-image-3102" title="red green - protanope" src="http://vis4.net/blog/wp-content/uploads/2011/11/redgreen-prot.png" alt="" width="522" height="440" /></p>
<p>For me, this is enough reason to simply forget about red-green color scales. Forever. Instead, I'll switch to blue-orange scales. After experimenting around a few minutes, I found that hue values of 220° (blue) and 30° (orange) work out fine:</p>
<p><img class="aligncenter size-full wp-image-3103" title="blue orange scale" src="http://vis4.net/blog/wp-content/uploads/2011/11/blueorange.png" alt="" width="522" height="440" /></p>
<p>To make a long story short, here are the Deuteranope and Protanope simulations:</p>
<p><img class="aligncenter size-full wp-image-3104" title="blue orange - deuteranope" src="http://vis4.net/blog/wp-content/uploads/2011/11/blueorange-deut1.png" alt="" width="522" height="440" /></p>
<p><img class="aligncenter size-full wp-image-3106" title="bue orange - protanope" src="http://vis4.net/blog/wp-content/uploads/2011/11/bueorange-prot.png" alt="" width="522" height="440" /></p>
<p>Also everything fine with the third kind of <a href="http://en.wikipedia.org/wiki/Color_blindness#Dichromacy">Dichromacy</a> called Tritanope or <em>blue</em> blindness.</p>
<p><img class="aligncenter size-full wp-image-3107" title="blue orange - tritanope" src="http://vis4.net/blog/wp-content/uploads/2011/11/blueorange-trit.png" alt="" width="522" height="440" /></p>
<p>At the end I want to recommend a perfect tool for on-the-fly simulation of color blindess which is called <a href="http://michelf.com/projects/sim-daltonism/">Sim Daltonism</a>. Many thanks to Michel Fortin for this. If you've heard of a similar tool for Windows and Linux, please let me know.</p>
<p><em>Update:</em></p>
<p><em>Color Oracle is another great tool for turning the whole screen into a color blindness simulation. Also, there's an some research work coming with that tool, namely <a href="http://people.oregonstate.edu/~jennyb/pdf/2007_JennyKelso_ColorDesign_hires.pdf">Color Design for the Color Vision Impaired</a> by Jenny &amp; Kelso, 2007. In short, they're going for purple-green instead of red-green:</em></p>
<p><a href="http://colororacle.cartography.ch/design.html"><img class="aligncenter size-full wp-image-3112" title="purple-green" src="http://vis4.net/blog/wp-content/uploads/2011/11/purple-green.png" alt="" width="522" height="350" /></a><br />
<!--:--></p>
]]></content:encoded>
			<wfw:commentRss>http://vis4.net/blog/posts/goodbye-redgreen-scales/?piwik_campaign=rss&#038;piwik_kwd=3098/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Ansatz zur automatischen Auswahl von Linienfarben in Diagrammen</title>
		<link>http://vis4.net/blog/posts/linienfarben-in-diagrammen/?piwik_campaign=rss&#038;piwik_kwd=487</link>
		<comments>http://vis4.net/blog/posts/linienfarben-in-diagrammen/?piwik_campaign=rss&#038;piwik_kwd=487#comments</comments>
		<pubDate>Sat, 17 Oct 2009 13:06:22 +0000</pubDate>
		<dc:creator>Gregor Aisch</dc:creator>
				<category><![CDATA[color]]></category>
		<category><![CDATA[chart]]></category>
		<category><![CDATA[Linien]]></category>
		<category><![CDATA[perception]]></category>

		<guid isPermaLink="false">http://vis4.net/blog/?p=487</guid>
		<description><![CDATA[Ein Problem bei der (automatischen) Erzeugung von Liniendiagrammen liegt in der Auswahl von unterscheidbaren Farben. In diesem Artikel wird ein Ansatz entwickelt, der dieses Problem l&#246;sen soll. Ausgangspunkt ist zun&#228;chst der RGB-Farbraum. Um verschiedene Farben zu erzeugen, k&#246;nnen einfach zuf&#228;llige Farben aus dem RGB-Raum ausgew&#228;hlt werden. Die folgende Darstellung zeigt eine derart getroffene Auswahl von [...]]]></description>
			<content:encoded><![CDATA[<p>Ein Problem bei der (automatischen) Erzeugung von Liniendiagrammen liegt in der Auswahl von unterscheidbaren Farben. In diesem Artikel wird ein Ansatz entwickelt, der dieses Problem l&ouml;sen soll.</p>
<p>Ausgangspunkt ist zun&auml;chst der RGB-Farbraum. Um verschiedene Farben zu erzeugen, k&ouml;nnen einfach zuf&auml;llige Farben aus dem RGB-Raum ausgew&auml;hlt werden. Die folgende Darstellung zeigt eine derart getroffene Auswahl von zehn verschiedenen Linienfarben (rechtsklicken um neue Zufallsfarben zu erzeugen):</p>
<p style="text-align: center;"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="90" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://vis4.net/experiments/huecorrection/LinesRandom.swf" /><embed type="application/x-shockwave-flash" width="400" height="90" src="http://vis4.net/experiments/huecorrection/LinesRandom.swf"></embed></object></p>
<p>Die Nachteile dieses Ansatzes sind offensichtlich und sind vor allem auch Nachteile des Farbmodells. Selbst eine gleichverteilte Auswahl von Farben im RGB-Raum w&uuml;rde mitunter zu nahezu identischen Farben f&uuml;hren. Daher habe ich mich im Folgenden auf den HSL-Farbraum konzentriert. Wie alle <a href="http://de.wikipedia.org/wiki/Perzeptuelle_Farbmodelle">wahrnehmungsorientierten Farbr&auml;ume</a> enth&auml;lt auch der HSL-Raum die Dimension <em>Farbwert </em> - ein Wert zwischen 0° und 360° der den Farbton bestimmt. Die folgende Darstellung zeigt die Auswahl von 10 Farben mit gleichem Abstand im Farbraum (in diesem Fall 36°):
</p>
<p style="text-align: center;"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="90" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://vis4.net/experiments/huecorrection/LinesHSL.swf" /><embed type="application/x-shockwave-flash" width="400" height="90" src="http://vis4.net/experiments/huecorrection/LinesHSL.swf"></embed></object></p>
<p>Wie man sieht bekommt man dadurch 10 Ausschnitte aus dem Regenbogenspektrum. Bei genauerem Hinsehen fallen aber immer noch Nachteile auf: So sind vor allem die beiden Gr&uuml;n- und Blaut&ouml;ne schwer voneinander zu unterscheiden. Um eine m&ouml;gliche Ursache daf&uuml;r zu nennen mache ich einen kurzen Ausflug zur <a href="http://de.wikipedia.org/wiki/Wahrnehmungspsychologie">Wahrnehmungspsychologie</a>. Auf unserer Netzhaut befinden sich zwei Typen von Rezeptorzellen, die sog. St&auml;bchen und Zapfen. W&auml;hrend die St&auml;bchen vor allem zum Sehen in der D&auml;mmerung benutzt werden, dienen <a href="http://de.wikipedia.org/wiki/Zapfen_%28Auge%29">Zapfen</a> zum Farbsehen. Nun gibt es unter den Zapfen-Zellen wiederum drei verschiedene <a href="http://de.wikipedia.org/wiki/Zapfen_%28Auge%29#Zapfentypen">Typen</a>, wovon jeder zur Wahrnehmung bestimmter Farbfrequenzen geeignet ist. Um die Sache kurz zu machen, es gibt jeweils einen Zapfentyp f&uuml;r rote, gr&uuml;ne und blaue Farbfrequenzen. Und jetzt kommts: die Verteilung der Zapfenzellen ist in etwa 10:1:1 (<em>rot </em>zu <em>gr&uuml;n </em>zu <em>blau</em>). Daher f&auml;llt es Menschen naturgem&auml;&szlig; leichter, Rott&ouml;ne voneinander zu unterscheiden als Blau- oder Gr&uuml;nt&ouml;ne.</p>
<p>Ich habe versucht, diesen Umstand &uuml;ber eine Transferfunktion f&uuml;r die Farbt&ouml;ne auszugleichen. Die folgende Abbildung zeigt oben einen Farbwertverlauf ohne und unten mit Korrektur. Wie man sehen kann, habe ich einfach den Bereich f&uuml;r gr&uuml;ne und blaue Farbt&ouml;ne "zusammengedr&uuml;ckt", um mehr Spielraum zwischen Rot und Gelb zu bekommen.</p>
<div id="attachment_488" class="wp-caption aligncenter" style="width: 658px"><img class="size-full wp-image-488" title="huecorrection" src="http://vis4.net/blog/wp-content/uploads/2009/10/huecorrection.png" alt="oben: normaler HSL-Verlauf, unten: HSL-Verlauf mit Farbtonkorrektur " width="648" height="131" /><p class="wp-caption-text">oben: normaler HSL-Verlauf, unten: HSL-Verlauf mit Farbtonkorrektur </p></div>
<p>W&auml;hlt man die 10 Zufallsfarben nun aus diesem, korrigierten Spektrum, erh&auml;lt man folgendes Resultat:
</p>
<p style="text-align: center;"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="90" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://vis4.net/experiments/huecorrection/LinesHSL2.swf" /><embed type="application/x-shockwave-flash" width="400" height="90" src="http://vis4.net/experiments/huecorrection/LinesHSL2.swf"></embed></object></p>
<p>Die Farbtonkorrektur hat etwas zur Unterscheidbarkeit der gr&uuml;nen und blauen Linien beigetragen. F&uuml;r den g&uuml;nstigen Fall, das die Linien<em>helligkeit</em> keine weitere Bedeutung in der Visualisierung hat, kann man die Unterscheidbarkeit der Linien weiter steigern, indem man abwechselnd helle und dunkle Linien verwendet:
</p>
<p style="text-align: center;"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="90" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://vis4.net/experiments/huecorrection/LinesHSL3.swf" /><embed type="application/x-shockwave-flash" width="400" height="90" src="http://vis4.net/experiments/huecorrection/LinesHSL3.swf"></embed></object></p>
<p>Zur Erzeugung der Abbildungen habe ich die ActionScript-Klasse <a href="http://vis4.net/blog/2009/07/perceptualcolor-farbraumtransformationen-in-as3/">PerceptualColor</a> verwendet. Die Farbwertkorrektur wird &uuml;ber die folgende Klasse HueCorrection gel&ouml;st. Ein- und Ausgabe f&uuml;r die Funktion <em>correctHue </em>ist ein Farbwinkel zwischen 0 und 360°.</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="actionscript"><pre class="de1"><span class="kw3">public</span> <span class="kw2">class</span> HueCorrection
<span class="br0">&#123;</span>
	<span class="kw3">private</span> <span class="kw3">static</span> <span class="kw2">var</span> _tf:<span class="kw3">Array</span> = <span class="br0">&#91;</span>
		<span class="br0">&#91;</span><span class="nu0">10</span>,<span class="nu0">5</span><span class="br0">&#93;</span>, <span class="br0">&#91;</span><span class="nu0">30</span>,<span class="nu0">45</span><span class="br0">&#93;</span>, <span class="br0">&#91;</span><span class="nu0">50</span>,<span class="nu0">70</span><span class="br0">&#93;</span>,
		<span class="br0">&#91;</span><span class="nu0">70</span>,<span class="nu0">94</span><span class="br0">&#93;</span>, <span class="br0">&#91;</span><span class="nu0">110</span>,<span class="nu0">100</span><span class="br0">&#93;</span>, <span class="br0">&#91;</span><span class="nu0">125</span>,<span class="nu0">115</span><span class="br0">&#93;</span>,
		<span class="br0">&#91;</span><span class="nu0">145</span>,<span class="nu0">148</span><span class="br0">&#93;</span>,<span class="br0">&#91;</span><span class="nu0">161</span>,<span class="nu0">174</span><span class="br0">&#93;</span>, <span class="br0">&#91;</span><span class="nu0">182</span>,<span class="nu0">179</span><span class="br0">&#93;</span>,
		<span class="br0">&#91;</span><span class="nu0">188</span>,<span class="nu0">185</span><span class="br0">&#93;</span>,
		<span class="br0">&#91;</span><span class="nu0">210</span>,<span class="nu0">225</span><span class="br0">&#93;</span>, <span class="br0">&#91;</span><span class="nu0">250</span>,<span class="nu0">255</span><span class="br0">&#93;</span>
	<span class="br0">&#93;</span>;
&nbsp;
	<span class="kw3">public</span> <span class="kw3">static</span> <span class="kw2">function</span> correctHue<span class="br0">&#40;</span>hue:<span class="kw3">Number</span><span class="br0">&#41;</span>:<span class="kw3">Number</span> <span class="br0">&#123;</span>
		<span class="kw2">var</span> h:uint = hue <span class="sy0">/</span> <span class="nu0">360</span> <span class="sy0">*</span> <span class="nu0">255</span>;
		<span class="kw2">var</span> new_hue:<span class="kw3">Number</span>;
		<span class="kw2">var</span> lx:<span class="kw3">Number</span> = <span class="nu0">0</span>;
		<span class="kw2">var</span> ly:<span class="kw3">Number</span> = <span class="nu0">0</span>;
&nbsp;
		<span class="kw1">for</span> <span class="br0">&#40;</span><span class="kw2">var</span> i:uint=<span class="nu0">0</span>; i<span class="sy0">&amp;</span>lt;_tf.<span class="kw3">length</span>; i++<span class="br0">&#41;</span> <span class="br0">&#123;</span>
			<span class="kw1">if</span> <span class="br0">&#40;</span>h == _tf<span class="br0">&#91;</span>i<span class="br0">&#93;</span><span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
				new_hue = _tf<span class="br0">&#91;</span>i<span class="br0">&#93;</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span>;
				<span class="kw1">break</span>;
			<span class="br0">&#125;</span> <span class="kw1">else</span> <span class="kw1">if</span> <span class="br0">&#40;</span>h <span class="sy0">&amp;</span>lt; _tf<span class="br0">&#91;</span>i<span class="br0">&#93;</span><span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
				new_hue = lx + <span class="br0">&#40;</span><span class="br0">&#40;</span>_tf<span class="br0">&#91;</span>i<span class="br0">&#93;</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span> - lx<span class="br0">&#41;</span> <span class="sy0">/</span> <span class="br0">&#40;</span>_tf<span class="br0">&#91;</span>i<span class="br0">&#93;</span><span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span> - ly<span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="sy0">*</span> <span class="br0">&#40;</span>h - ly<span class="br0">&#41;</span>;
				<span class="kw1">break</span>;
			<span class="br0">&#125;</span>
			lx = _tf<span class="br0">&#91;</span>i<span class="br0">&#93;</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span>;
			ly = _tf<span class="br0">&#91;</span>i<span class="br0">&#93;</span><span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span>;
		<span class="br0">&#125;</span>
		<span class="kw1">return</span> new_hue <span class="sy0">/</span> <span class="nu0">255</span> <span class="sy0">*</span> <span class="nu0">360</span>;
	<span class="br0">&#125;</span>
<span class="br0">&#125;</span></pre></div></div></div></div></div></div></div>

</p>
]]></content:encoded>
			<wfw:commentRss>http://vis4.net/blog/posts/linienfarben-in-diagrammen/?piwik_campaign=rss&#038;piwik_kwd=487/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lesbarkeitsschwellen von farbigem Text – Vergleich zwischen HSL- und HSB-Farbmodell</title>
		<link>http://vis4.net/blog/posts/textlesbarkeit-hsl-hsb/?piwik_campaign=rss&#038;piwik_kwd=215</link>
		<comments>http://vis4.net/blog/posts/textlesbarkeit-hsl-hsb/?piwik_campaign=rss&#038;piwik_kwd=215#comments</comments>
		<pubDate>Wed, 05 Aug 2009 00:15:29 +0000</pubDate>
		<dc:creator>Gregor Aisch</dc:creator>
				<category><![CDATA[color]]></category>
		<category><![CDATA[featured]]></category>
		<category><![CDATA[flash/air]]></category>
		<category><![CDATA[Helligkeit]]></category>
		<category><![CDATA[perception]]></category>
		<category><![CDATA[readability]]></category>
		<category><![CDATA[Small multiples]]></category>
		<category><![CDATA[Text]]></category>

		<guid isPermaLink="false">http://vis4.net/blog/?p=215</guid>
		<description><![CDATA[K&#252;rzlich stand ich bei einer Visualisierung vor folgendem Problem: Welche Textfarben kann man noch gut auf einem wei&#223;en Hintergrund erkennen und welche nicht? Ich erinnere mich noch eine brute-force-L&#246;sung, die ich vor einigen Jahren bei einem &#228;hnlichen Problem gew&#228;hlt hatte: Nimm die Farbe und mische sie mit schwarz! Auch wenn das mein Problem damals prinzipiell [...]]]></description>
			<content:encoded><![CDATA[<p>K&uuml;rzlich stand ich bei einer Visualisierung vor folgendem Problem: Welche Textfarben kann man noch gut auf einem wei&szlig;en Hintergrund erkennen und welche nicht? Ich erinnere mich noch eine brute-force-L&ouml;sung, die ich vor einigen Jahren bei einem &auml;hnlichen Problem gew&auml;hlt hatte: <em>Nimm die Farbe und mische sie mit schwarz!</em><span id="more-215"></span><br />
<p style='text-align:center;'><span class='MathJax_Preview'><img src='http://vis4.net/blog/wp-content/plugins/latex/cache/tex_b7681fe281dbf7036bf8f00e30992cd0.gif' style='' class='tex' alt="\left(\begin{array}{c}<br />
r'\\<br />
g'\\<br />
b'\end{array}\right)=\alpha\cdot\left(\begin{array}{c}<br />
r\\<br />
g\\<br />
b\end{array}\right);0<\alpha<1" /></span></p></p>
<p>Auch wenn das mein Problem damals prinzipiell gel&ouml;st hatte, hat dieser Weg einige Nachteile: Zum einen werden auch solche Farben verdunkelt, die man vorher ohne Probleme h&auml;tte lesen k&ouml;nnen. Damit verschenkt man gewisserma&szlig;en Farben, da aus einem dunkelrot schnell ein undefinierbares schwarzgraubraun wird. Zum anderen verlieren die Farben damit an S&auml;ttigung, der Gesamteindruck wird folglich farbloser (siehe abschlie&szlig;ende <a href="#textcontrast2">Visualisierung</a>, Spalte "+50% schwarz").</p>
<p>Diesmal wollte ich es also besser l&ouml;sen und  dazu die Farben in einen <a href="http://vis4.net/blog/2009/07/visualisierung-perzeptueller-farbmodelle/">wahrnehmungsoptimierten Farbraum</a> umrechnen. Besonders geeignet schienen mir das HSL und HSB-Modell, da dort die vielversprechende Komponente <em>Farbhelligkeit </em>vorkommt. Angenommen, die Helligkeit <em>h</em> ist bekannt, so kann ein einfacher Schwellwert <em>β</em> (= Lesbarkeitsschwelle) festgelegt werden:</p>
<p><p style='text-align:center;'><span class='MathJax_Preview'><img src='http://vis4.net/blog/wp-content/plugins/latex/cache/tex_5560a1030b159be4822b2b6c71407d00.gif' style='' class='tex' alt="h=\begin{cases}<br />
h & ,h<\beta<br />
\\<br />
\beta &<br />
\end{cases}" /></span></p></p>
<p>Doch welches Modell ist nun besser geeignet? Die Modelle HSL und HSB unterscheiden sich vor allem in der Interpretation der Helligkeit. Bei HSL bezeichnet L die relative Helligkeit (<em>lightness</em>), im Gegensatz zur absoluten Helligkeit B (<em>brightness</em>) bei HSB<sup class='footnote'><a href='#fn-215-1' id='fnref-215-1'>1</a></sup>. Schauen wir uns doch zuerst mal an, wie die lightness und die brightness aus einer RGB-Farbe berechtnet werden. Als relative Helligkeit wird einfach der Mittelwert aus der minimalen und maximalen Farbkomponente festgelegt, w&auml;hrend die absolute Helligkeit durch eine affine Linearkombination aller dreier Farbkomponenten beschrieben wird<sup class='footnote'><a href='#fn-215-2' id='fnref-215-2'>2</a></sup>:</p>
<p><p style='text-align:center;'><span class='MathJax_Preview'><img src='http://vis4.net/blog/wp-content/plugins/latex/cache/tex_211c2425707abfb680ab2b55ac7e83cc.gif' style='' class='tex' alt="lightness=0.5 \cdot [MAX(r,g,b)+MIN(r,g,b)] " /></span></p> <p style='text-align:center;'><span class='MathJax_Preview'><img src='http://vis4.net/blog/wp-content/plugins/latex/cache/tex_30d09cd1740980597eda4893cc7cb9e6.gif' style='' class='tex' alt="brightness=0.2126 \cdot r + 0.7152 \cdot g + 0.0722 \cdot b " /></span></p></p>
<p>Die unterschiedliche Komponenten-Wichtung in der brightness-Berechnung hat den einfachen Grund, dass die Farbkomponenten tats&auml;chlich unterschiedlich hell wahrgenommen werden. Diesen Effekt verdeutlicht die Abbildung 1: Obwohl alle drei Farben eine relative Helligkeit von 50% haben<sup class='footnote'><a href='#fn-215-3' id='fnref-215-3'>3</a></sup> nehmen wir die gelbe Schrift eindeutig heller wahr als die blaue. Und eben dieser Unterschied spiegelt sich in den entsprechenden brightness-Werten wieder, bei denen unser blau mit 7%, das gr&uuml;n mit 72% und das gelb mit 93% abschneidet. Sieht ganz so aus, als h&auml;tten wir unser Lieblingsmodell gefunden!</p>
<div id="attachment_283" class="wp-caption aligncenter" style="width: 596px"><img class="size-full wp-image-283" title="3colors" src="http://vis4.net/blog/wp-content/uploads/2009/08/3colors.png" alt="Diese drei Farben haben dieselbe relative Helligkeit" width="586" height="70" /><p class="wp-caption-text">Abb.1: Diese drei Farben haben dieselbe relative Helligkeit</p></div>
<h3>Und wo bleibt die Visualisierung???</h3>
<p>Um die Ergebnisse der theoretischen Analyse zu verifizieren, habe ich wieder eine kleine Demonstration zusammengebastelt. Auf der Visualisierung verteilt sich jede Menge Text, dessen Farbe sich von links nach rechts und dessen Helligkeit von oben nach unten &auml;ndert. Oben links kann man zwischen dem HSL- und HSB-Modell umschalten.</p>
<p>Erwartungsgem&auml;&szlig; f&auml;llt sogleich der "Einknick" der Lesbarkeit HSL-Modell auf. Versucht man f&uuml;r die Helligkeit eine Schwelle β festzulegen, bis zu der der Text in jeder Farbe noch gelesen werden kann, so muss man sich wegen der schlechten Lesbarkeit des gelben Textes auf etwa 45% begrenzen. Im HSB-Modell kann man die Schwelle schon deutlich h&ouml;her ansetzen, erst ab etwa 70% st&ouml;rt das grelle Cyan. Aus Neugier habe ich diesen Test anschlie&szlig;end noch auf schwarzem Hintergrund wiederholt, in der Erwartung hier w&uuml;rde sich ein &auml;hnliches Ergebnis zeigen. Zuersteinmal war ich verwundert dass pl&ouml;tzlich der HSB-Raum chaotischer aussieht als der HSL-Raum und ich wollte daraus schon schlussfolgern, dass sich das HSB-Modell nur auf hellem Hintergrund besser eignet als HSL. Schaut man jedoch genauer hin, so findet man auch hier f&uuml;r den HSB-Raum eine bessere Lesbarkeitsschwelle von etwa 24% (im Gegensatz zu etwa 36% bei HSL, wo das dunkelblau sehr schlecht lesbar ist).</p>
<p><object id="textcontrast1" style="width: 650px; height: 450px;" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="650" height="450" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://vis4.net/experiments/textcontrast/TextContrast.swf" /><param name="allowFullscreen" value="true" /><param name="allowfullscreen" value="true" /><embed id="textcontrast1" style="width: 650px; height: 450px;" type="application/x-shockwave-flash" width="650" height="450" src="http://vis4.net/experiments/textcontrast/TextContrast.swf" allowfullscreen="true"></embed></object></p>
<h3>Ergebnisse</h3>
<p>In der folgenden Visualisierung k&ouml;nnen die drei genannten Ans&auml;tze interaktiv ausprobiert werden.<br />
<a id="textcontrast2" name="textcontrast2"></a><br />
<object style="width: 650px; height: 450px;" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="650" height="450" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://vis4.net/experiments/textcontrast/TextContrast2.swf" /><param name="allowFullscreen" value="true" /><param name="allowfullscreen" value="true" /><embed style="width: 650px; height: 450px;" type="application/x-shockwave-flash" width="650" height="450" src="http://vis4.net/experiments/textcontrast/TextContrast2.swf" allowfullscreen="true"></embed></object></p>
<h3>Fazit</h3>
<ol>
<li>Zur Berechnung der Helligkeit von Text zur Feststellung seiner Lesbarkeit eignet sich das HSB-Modell besser als das HSL-Modell. Dies gilt sowohl auf hellem wie auch dunklem Hintergrund.</li>
<li>Farbiger Text l&auml;sst sich am Monitor angenehmer lesen, wenn er auf schwarzem Grund steht.</li>
</ol>
<div class='footnotes'>
<div class='footnotedivider'></div>
<ol>
<li id='fn-215-1'>hierbei beziehe ich mich vor allem auf den deutschen Wikipedia-Artikel <a href="http://de.wikipedia.org/wiki/HSV-Farbraum">HSV-Farbraum</a>. Viele der im Netz rumgeisternden Definitionen des HSB-Raums setzen ihn mit dem HSV-Raum gleich, was meiner Ansicht nach falsch ist <span class='footnotereverse'><a href='#fnref-215-1'>&#8617;</a></span></li>
<li id='fn-215-2'>siehe <a href="http://en.wikipedia.org/wiki/HSL_and_HSV#Conversion_from_RGB_to_HSL_or_HSV">http://en.wikipedia.org/wiki/HSL_and_HSV</a> und <a href="http://en.wikipedia.org/wiki/Luminance_%28relative%29">http://en.wikipedia.org/wiki/Luminance (relative)</a> <span class='footnotereverse'><a href='#fnref-215-2'>&#8617;</a></span></li>
<li id='fn-215-3'>(255 + 0)/2 = 127.5, normiert auf 255 <span class='footnotereverse'><a href='#fnref-215-3'>&#8617;</a></span></li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://vis4.net/blog/posts/textlesbarkeit-hsl-hsb/?piwik_campaign=rss&#038;piwik_kwd=215/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Visualization of Perceptual Color Spaces</title>
		<link>http://vis4.net/blog/posts/visualisierung-perzeptueller-farbmodelle/?piwik_campaign=rss&#038;piwik_kwd=86</link>
		<comments>http://vis4.net/blog/posts/visualisierung-perzeptueller-farbmodelle/?piwik_campaign=rss&#038;piwik_kwd=86#comments</comments>
		<pubDate>Wed, 29 Jul 2009 21:13:40 +0000</pubDate>
		<dc:creator>Gregor Aisch</dc:creator>
				<category><![CDATA[color]]></category>
		<category><![CDATA[visualized]]></category>
		<category><![CDATA[perception]]></category>
		<category><![CDATA[Small multiples]]></category>

		<guid isPermaLink="false">http://vis4.net/blog/?p=86</guid>
		<description><![CDATA[Die folgenden Visualisierungen sollen die Farbr&#228;ume HSV, HSI, HSL und HSB veranschaulichen. Dazu wurden jeweils 48 Farbkreise mit unterschiedlicher S&#228;ttigung und Farbwert/Helligkeit/Intensit&#228;t/Leuchtdichte auf einer Fl&#228;che angeordnet. Die S&#228;ttigung f&#228;llt von oben nach unten hin, Farbwert/Helligkeit/Intensit&#228;t fallen hingegen von links nach rechts. Bei den Darstellungen handelt es sich um Flashfilme, zur Berechnung wurde die Klasse PerceptualColor [...]]]></description>
			<content:encoded><![CDATA[<p><!--:de-->Die folgenden Visualisierungen sollen die  Farbr&auml;ume HSV, HSI, HSL und HSB veranschaulichen. Dazu wurden jeweils 48 Farbkreise mit unterschiedlicher S&auml;ttigung und Farbwert/Helligkeit/Intensit&auml;t/Leuchtdichte auf einer Fl&auml;che angeordnet. Die S&auml;ttigung f&auml;llt von oben nach unten hin, Farbwert/Helligkeit/Intensit&auml;t fallen hingegen von links nach rechts. Bei den Darstellungen handelt es sich um Flashfilme, zur Berechnung wurde die Klasse <a href="http://vis4.net/blog/?p=72"><em>PerceptualColor</em></a> verwendet. Die Visualisierungen k&ouml;nnen auch <a href="http://vis4.net/experiments/huecircles/hsv.html">im Vollbild</a> betrachtet werden.<a href="http://vis4.net/experiments/huecircles/hsv.html"><br />
</a></p>
<div id="attachment_91" class="wp-caption aligncenter" style="width: 670px"><object style="width: 660px; height: 510px;" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="660" height="510" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="loop" value="false" /><param name="menu" value="false" /><param name="flashvars" value="mode=hsv" /><param name="src" value="http://vis4.net/experiments/huecircles/HueCircles.swf" /><embed style="width: 660px; height: 510px;" type="application/x-shockwave-flash" width="660" height="510" src="http://vis4.net/experiments/huecircles/HueCircles.swf" flashvars="mode=hsv" menu="false" loop="false"></embed></object><p class="wp-caption-text">HSV-Farbraum</p></div>
<div id="attachment_89" class="wp-caption aligncenter" style="width: 670px"><object style="width: 660px; height: 510px;" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="660" height="510" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="loop" value="false" /><param name="menu" value="false" /><param name="flashvars" value="mode=hsi" /><param name="src" value="http://vis4.net/experiments/huecircles/HueCircles.swf" /><embed style="width: 660px; height: 510px;" type="application/x-shockwave-flash" width="660" height="510" src="http://vis4.net/experiments/huecircles/HueCircles.swf" flashvars="mode=hsi" menu="false" loop="false"></embed></object><p class="wp-caption-text">HSI-Farbraum</p></div>
<div id="attachment_90" class="wp-caption aligncenter" style="width: 670px"><object style="width: 660px; height: 510px;" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="660" height="510" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="loop" value="false" /><param name="menu" value="false" /><param name="flashvars" value="mode=hsl" /><param name="src" value="http://vis4.net/experiments/huecircles/HueCircles.swf" /><embed style="width: 660px; height: 510px;" type="application/x-shockwave-flash" width="660" height="510" src="http://vis4.net/experiments/huecircles/HueCircles.swf" flashvars="mode=hsl" menu="false" loop="false"></embed></object><p class="wp-caption-text">HSL-Farbraum</p></div>
<div id="attachment_90" class="wp-caption aligncenter" style="width: 670px"><object style="width: 660px; height: 510px;" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="660" height="510" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="loop" value="false" /><param name="menu" value="false" /><param name="flashvars" value="mode=hsb" /><param name="src" value="http://vis4.net/experiments/huecircles/HueCircles.swf" /><embed style="width: 660px; height: 510px;" type="application/x-shockwave-flash" width="660" height="510" src="http://vis4.net/experiments/huecircles/HueCircles.swf" flashvars="mode=hsb" menu="false" loop="false"></embed></object><p class="wp-caption-text">HSB-Farbraum</p></div>
<p><!--:--></p>
]]></content:encoded>
			<wfw:commentRss>http://vis4.net/blog/posts/visualisierung-perzeptueller-farbmodelle/?piwik_campaign=rss&#038;piwik_kwd=86/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Color Space Transformations in ActionScript</title>
		<link>http://vis4.net/blog/posts/color-space-transformations-in-actionscript-2/?piwik_campaign=rss&#038;piwik_kwd=1241</link>
		<comments>http://vis4.net/blog/posts/color-space-transformations-in-actionscript-2/?piwik_campaign=rss&#038;piwik_kwd=1241#comments</comments>
		<pubDate>Wed, 29 Jul 2009 17:07:11 +0000</pubDate>
		<dc:creator>Gregor Aisch</dc:creator>
				<category><![CDATA[color]]></category>

		<guid isPermaLink="false">http://vis4.net/blog/?p=1241</guid>
		<description><![CDATA[Here is a small actionscript3 class for converting colors between different color spaces like RGB, HSV, HSL and HSB. You can input and output the colors either as integer or string value or as serperated color components (e.g. hue, saturation and lightness). The class has no other dependencies. API /* * Modes: * PerceptualColor.HSV, PerceptualColor.HSL, [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a small actionscript3 class for converting colors between different color spaces like RGB, HSV, HSL and HSB. You can input and output the colors either as integer or string value or as serperated color components (e.g. hue, saturation and lightness). The class has no other dependencies.</p>
<h3>API</h3>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="actionscript3"><pre class="de1"><span class="coMULTI">/*
 * Modes:
 * PerceptualColor.HSV, PerceptualColor.HSL, PerceptualColor.HSI
 */</span> 
&nbsp;
<span class="kw2">var</span> <span class="kw7">color</span><span class="sy0">:</span>PerceptualColor<span class="sy0">;</span>
&nbsp;
<span class="co1">// Konstruktoren</span>
<span class="kw7">color</span> = <span class="kw1">new</span> PerceptualColor<span class="br0">&#40;</span><span class="kw7">mode</span><span class="sy0">:</span><span class="kw5">String</span> = <span class="st0">'hsl'</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="kw7">color</span> = PerceptualColor<span class="sy0">.</span>fromInt<span class="br0">&#40;</span>i<span class="sy0">:</span><span class="kw5">uint</span><span class="sy0">,</span> <span class="kw7">mode</span> = <span class="st0">'hsl'</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="kw7">color</span> = PerceptualColor<span class="sy0">.</span>fromHex<span class="br0">&#40;</span>h<span class="sy0">:</span><span class="kw5">String</span><span class="sy0">,</span> <span class="kw7">mode</span> = <span class="st0">'hsl'</span><span class="br0">&#41;</span><span class="sy0">;</span> <span class="co1">// format: &quot;#RRGGBB&quot;</span>
<span class="kw7">color</span> = PerceptualColor<span class="sy0">.</span>fromRGB<span class="br0">&#40;</span>r<span class="sy0">:</span><span class="kw5">uint</span><span class="sy0">,</span> g<span class="sy0">:</span><span class="kw5">uint</span><span class="sy0">,</span> <span class="kw7">b</span><span class="sy0">:</span><span class="kw5">uint</span><span class="sy0">,</span> <span class="kw7">mode</span> = <span class="st0">'hsl'</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="kw7">color</span> = PerceptualColor<span class="sy0">.</span>fromHSV<span class="br0">&#40;</span>h<span class="sy0">:</span><span class="kw5">Number</span><span class="sy0">,</span> s<span class="sy0">:</span><span class="kw5">Number</span><span class="sy0">,</span> v<span class="sy0">:</span><span class="kw5">Number</span><span class="sy0">,</span> <span class="kw7">mode</span> = <span class="st0">'hsv'</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="kw7">color</span> = PerceptualColor<span class="sy0">.</span>fromHSL<span class="br0">&#40;</span>h<span class="sy0">:</span><span class="kw5">Number</span><span class="sy0">,</span> s<span class="sy0">:</span><span class="kw5">Number</span><span class="sy0">,</span> l<span class="sy0">:</span><span class="kw5">Number</span><span class="sy0">,</span> <span class="kw7">mode</span> = <span class="st0">'hsl'</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="kw7">color</span> = PerceptualColor<span class="sy0">.</span>fromHSI<span class="br0">&#40;</span>h<span class="sy0">:</span><span class="kw5">Number</span><span class="sy0">,</span> s<span class="sy0">:</span><span class="kw5">Number</span><span class="sy0">,</span> i<span class="sy0">:</span><span class="kw5">Number</span><span class="sy0">,</span> <span class="kw7">mode</span> = <span class="st0">'hsi'</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
<span class="co1">// RGB-Setter (Getter äquivalent)</span>
<span class="kw7">color</span><span class="sy0">.</span>intValue = 0x00BBFF<span class="sy0">;</span>
<span class="kw7">color</span><span class="sy0">.</span>hexValue = <span class="st0">&quot;#00BBFF&quot;</span><span class="sy0">;</span>
<span class="kw7">color</span><span class="sy0">.</span>red = <span class="nu0">0</span><span class="sy0">;</span>
<span class="kw7">color</span><span class="sy0">.</span>green = <span class="nu0">125</span><span class="sy0">;</span>
<span class="kw7">color</span><span class="sy0">.</span>blue = <span class="nu0">40</span><span class="sy0">;</span>
<span class="kw7">color</span><span class="sy0">.</span>setRGB<span class="br0">&#40;</span><span class="nu0">0</span><span class="sy0">,</span> <span class="nu0">125</span><span class="sy0">,</span> <span class="nu0">40</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
<span class="co1">// HSX-Setter (Getter äquivalent)</span>
<span class="kw7">color</span><span class="sy0">.</span>hue = <span class="nu0">0</span><span class="sy0">;</span>
<span class="kw7">color</span><span class="sy0">.</span>saturation = <span class="nu0">0.6</span><span class="sy0">;</span>
<span class="co1">// nur im HSV-Modus</span>
<span class="kw7">color</span><span class="sy0">.</span><span class="kw7">value</span> = <span class="nu0">1</span><span class="sy0">;</span>
<span class="kw7">color</span><span class="sy0">.</span>setHSV<span class="br0">&#40;</span><span class="nu0">0</span><span class="sy0">,</span> <span class="nu0">0.6</span><span class="sy0">,</span> <span class="nu0">1</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="co1">// nur im HSL-Modus</span>
<span class="kw7">color</span><span class="sy0">.</span>lightness = <span class="nu0">1</span><span class="sy0">;</span>
<span class="kw7">color</span><span class="sy0">.</span>setHSL<span class="br0">&#40;</span><span class="nu0">0</span><span class="sy0">,</span> <span class="nu0">0.6</span><span class="sy0">,</span> <span class="nu0">1</span><span class="br0">&#41;</span><span class="sy0">;</span>
 <span class="co1">// funktioniert nur im HSV-Modus</span>
<span class="kw7">color</span><span class="sy0">.</span>intensity = <span class="nu0">1</span><span class="sy0">;</span>
<span class="kw7">color</span><span class="sy0">.</span>setHSI<span class="br0">&#40;</span><span class="nu0">0</span><span class="sy0">,</span> <span class="nu0">0.6</span><span class="sy0">,</span> <span class="nu0">1</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
<span class="co1">// Modus ändern</span>
<span class="kw7">color</span><span class="sy0">.</span><span class="kw7">mode</span> = PerceptualColor<span class="sy0">.</span>HSL<span class="sy0">;</span></pre></div></div></div></div></div></div></div>


<h3>Usage Examples</h3>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="actionscript3"><pre class="de1"><span class="coMULTI">/*
 * Beispiel 1:
 * Einlesen einer Integer-Farbe, Sättigung auf 50% setzen, Hex-Farbe ausgeben
 */</span>
<span class="kw2">var</span> <span class="kw7">color</span><span class="sy0">:</span>PerceptualColor = PerceptualColor<span class="sy0">.</span>fromInt<span class="br0">&#40;</span>0xFF0000<span class="br0">&#41;</span><span class="sy0">;</span>
<span class="kw7">color</span><span class="sy0">.</span>saturation = <span class="nu0">0.5</span><span class="sy0">;</span>
<span class="kw7">trace</span><span class="br0">&#40;</span><span class="kw7">color</span><span class="sy0">.</span>hexValue<span class="br0">&#41;</span><span class="sy0">;</span> <span class="co1">// Ausgabe: &quot;#BF3F3F&quot;</span>
&nbsp;
<span class="coMULTI">/*
 * Beispiel 2:
 * Einlesen einer RGB-Farbe, Helligkeit auf 70% begrenzen, RGB-Were ausgeben
 */</span>
<span class="kw7">color</span> = PerceptualColor<span class="sy0">.</span>fromRGB<span class="br0">&#40;</span><span class="nu0">220</span><span class="sy0">,</span> <span class="nu0">250</span><span class="sy0">,</span> <span class="nu0">180</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="kw1">if</span> <span class="br0">&#40;</span><span class="kw7">color</span><span class="sy0">.</span>lightness <span class="sy0">&amp;</span>gt<span class="sy0">;</span> <span class="nu0">0.7</span><span class="br0">&#41;</span> <span class="kw7">color</span><span class="sy0">.</span>lightness = <span class="nu0">0.7</span><span class="sy0">;</span>
<span class="kw7">trace</span><span class="br0">&#40;</span><span class="kw7">color</span><span class="sy0">.</span>red<span class="sy0">,</span> <span class="kw7">color</span><span class="sy0">.</span>green<span class="sy0">,</span> <span class="kw7">color</span><span class="sy0">.</span>blue<span class="br0">&#41;</span><span class="sy0">;</span> <span class="co1">// Ausgabe: &quot;188 245 111&quot;</span>
&nbsp;
<span class="coMULTI">/*
 * Beispiel 3:
 * Einlesen einer HSV-Farbe, Umwandlung in den HSL-Raum, Helligkeit auf 50% setzen,
 * zurück in den HSV-Raum umwandeln, Ausgabe
 */</span>
<span class="kw7">color</span> = PerceptualColor<span class="sy0">.</span>fromHSV<span class="br0">&#40;</span><span class="nu0">0</span><span class="sy0">,</span> <span class="sy0">.</span>7<span class="sy0">,</span> <span class="sy0">.</span>9<span class="br0">&#41;</span><span class="sy0">;</span>
<span class="kw7">trace</span><span class="br0">&#40;</span><span class="kw7">color</span><span class="sy0">.</span>hue<span class="sy0">,</span> <span class="kw7">color</span><span class="sy0">.</span>saturation<span class="sy0">,</span> <span class="kw7">color</span><span class="sy0">.</span><span class="kw7">value</span><span class="br0">&#41;</span><span class="sy0">;</span> <span class="co1">// Ausgabe: &quot;0 0.7 0.9&quot;</span>
<span class="kw7">color</span><span class="sy0">.</span><span class="kw7">mode</span> = PerceptualColor<span class="sy0">.</span>HSL<span class="sy0">;</span>
<span class="kw7">trace</span><span class="br0">&#40;</span><span class="kw7">color</span><span class="sy0">.</span>hue<span class="sy0">,</span> <span class="kw7">color</span><span class="sy0">.</span>saturation<span class="sy0">,</span> <span class="kw7">color</span><span class="sy0">.</span>lightness<span class="br0">&#41;</span><span class="sy0">;</span> <span class="co1">// Ausgabe: &quot;0 0.755 0.582&quot;</span>
<span class="kw7">color</span><span class="sy0">.</span>lightness = <span class="nu0">0.5</span><span class="sy0">;</span>
<span class="kw7">color</span><span class="sy0">.</span><span class="kw7">mode</span> = PerceptualColor<span class="sy0">.</span>HSV<span class="sy0">;</span>
<span class="kw7">trace</span><span class="br0">&#40;</span><span class="kw7">color</span><span class="sy0">.</span>hue<span class="sy0">,</span> <span class="kw7">color</span><span class="sy0">.</span>saturation<span class="sy0">,</span> <span class="kw7">color</span><span class="sy0">.</span><span class="kw7">value</span><span class="br0">&#41;</span><span class="sy0">;</span> <span class="co1">// Ausgabe: &quot;0 0.861 0.874&quot;</span></pre></div></div></div></div></div></div></div>


<h3>Download</h3>
<div id="download">Download: <a href="http://vis4.net/download/PerceptualColor.as">PerceptualColor.as</a> (10,4 kB)</div>
]]></content:encoded>
			<wfw:commentRss>http://vis4.net/blog/posts/color-space-transformations-in-actionscript-2/?piwik_campaign=rss&#038;piwik_kwd=1241/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached (User agent is rejected)
Database Caching 3/47 queries in 0.024 seconds using memcached
Object Caching 916/987 objects using memcached
Content Delivery Network via N/A

Served from: www.vis4.net @ 2012-02-05 22:35:40 -->
