PTS Blog

Main menu:

PTS Utilities

Commercial Utilities developed by Peltier Technical Services

  Waterfall Chart

Excel Books

Books that I own and use while developing in Excel

Goods and Services

Excel or charting related products and services which I use or feel are worthwhile additions

Subscribe

Site search


Recent Posts

Recently Commented

February 2008
S M T W T F S
    Mar »
 12
3456789
10111213141516
17181920212223
242526272829  

Archive


 

Categories


 

Using Colors in Excel Charts

by Jon Peltier
Peltier Technical Services, Inc., Copyright © 2008. All rights reserved.

Stephen Few of Perceptual Edge is a reknowned expert on data visualization for analysis and communication of quantitative business information. He is the author of Show me the Numbers and Information Dashboard Design, two books that explain techniques which display information effectively, and why these techniques are an improvement over common practices and over the defaults of common software, such as Excel. The Perceptual Edge web site includes Stephen’s blog, an extensive library of articles by Stephen and other experts in data visualization and data visualization, and much more content.

Stephen recently posted an article which discusses Practical Rules for Using Color in Charts. I certainly can’t improve on Stephen’s article, other than to recommend this article and Stephen’s other resources to those who are really interested in improving their own presentations. I will also point to a couple resources he cites in his article. One is an article by Maureen Stone, an expert in digital color as well as information presentation, entitled Choosing Colors for Data Visualization. The other is Cindy Brewer’s web site which features an elegant Flash application that generates many different color palettes designed to make maps and charts more effective.

I thought a good topic would be a brief discussion of Excel’s color system, followed by a practical Excel-based implementation of the principles laid out in the resources above.

Excel 2003’s Color System

The color system in Excel 97 through 2003 is rather rudimentary. Excel 2007’s color system is very much enhanced, and will not be addressed in this article.

The Excel 2003 color palette consists of 56 colors, accessed through the color palette in dialogs and menus, and through code by a ColorIndex. The user can adjust any of the 56 colors, but these are the only colors available for Excel objects. (Shapes can actually make use of any of the millions of Windows collors, but that’s not germaine to Excel charts.)

The user modifies the color palette by clicking on the Tools menu, choosing Options, and clicking on the Color tab, which displays the dialog below. The 56 colors are arrayed in all their glory. Note that the top five rows comprise the 40 “Standard” colors, which are always visible on the menu palettes. There are also two rows of special colors, one used for default chart fill colors (for bars, columns, and areas) and the other for default line and marker colors.

Tools - Options - Color

The user modifies a color in the palette by selecting it and clicking Modify. This pops up another dialog with two tabs. From this dialog (see below), the user can either select a color from a wider selection of “standard” colors, or define a color by dragging a cursor or entering precise red, green, and blue values. (The user should look up the definition of colors in terms of red, green, and blue. The only hint I’ll give here is that you can make millions of colors by varying each of these three components from 0 to 255.) Changes made in this dialog are specific to the active workbook only. From the dialog, the user can also reset the palette to Excel’s default palette, or copy a palette from another open workbook.

Tools - Options - Standard Colors Tools - Options - Custom Colors

Standard Chart Colors

When you make an Excel chart, it starts out looking something like one of these:

Default Excel Column Chart

Default Excel Line Chart

There are a few things we can change right away. First, the ugly gray plot area background should be changed to white. Second, if gridlines are necessary at all, they chould be changed to the lightest gray available. The black border around the entire chart can be removed, while the plot area border, axes, and axis tick labels should be changed to a medium gray, so their appearance does not draw attention from the data. The borders around the columns should be removed as well.

In the charts below, I’ve also made a minor adjustment to the color palette, changing each of the gray shades in the right column to a shade two clicks lighter in the standard color modification dialog. Since the default greens in the palette are either too dark or too bright, I’ve sacrificed the intermediate green and changed it to something that’s a nicer shade, definitely green, but between kelly and forest greens. I have not yet changed the default chart colors in the palette. The charts do look better, but the default series colors leave much to be desired.

Default-ish Excel Column Chart

Default-ish Excel Line Chart

Better Excel Chart Colors

This is what the Color Brewer utility looks like:

Color Brewer

You can select a number of classes (i.e., different colors in the palette), and a type of palette. Sequential means graduated shading from dark to light; Diverging means gradually changing from one dark color to white or a light shade in the middle to another dark color; Qualitative means the colors are defined with similar intensity so that no one color appears more important than any other. For typical charts the qualitative style palette is the best choice.

For fills in chart columns, bars, or areas, light to medium colors work best, unless you want to emphasize a small number of points. For lines and markers, medium colors work well.

I’ve spent a little time with the ColorBrewer, and used it to define a few sets of custom chart colors. The default palette and two of my custom ones are shown below. The names “Paired” and “Set2 Dark2″ derive from names of the color combinations from the ColorBrewer. I’ve slightly modified a couple of the colors, but most are as defined by the ColorBrewer.

Default Palette
Default Excel Charting Palette

Palette 'Paired'
Custom Charting Palette - Paired

Palette - 'Set2 Dark2'
Custom Charting Palette - Set2 Dark2 (my favorite)

Palette Chooser Utility

To reward persistent readers who have made it this far, I’ve built a small utility to apply a few of these palettes to the active workbook. It is located in the zip file PaletteChooser.zip. Unzip this file, and open the workbook PaletteChooser.xls with macros enabled. The workbook was created in Excel 2003, and should also work in Excel 2002 and 2000. I don’t know whether it will work in Excel 97 or in any flavor of MacExcel, and it is irrelevant to Excel 2007. When the workbook is opened it adds an item called “Custom Palette” to the Format menu; this menu item is removed when the file is closed. Colors are stored in the Colors worksheet of PaletteChooser.xls and displayed in the Prelim worksheet; for each palette, most of the changes are based on ColorBrewer colors, but I’ve also included my adjusted grays and greens. To modify another workbook, activate it first before selecting the Custom Palette menu item. Invoking this menu command will pop up the following dialog:

Palette Chooser Dialog

The custom palettes stored in the Palette Chooser workbook are listed in the dialog. Clicking Apply or double-clicking on a palette entry in the list box will apply it to the active workbook. When you find one you like, click Done. If you want to cancel the changes, click Cancel. If I get ambitious I will post instructions here for anyone who wants to define their own palettes; clever Excel users may figure it out on their own.

Share/Save/Bookmark

Comments

Comment from Ross
Time: Thursday, February 21, 2008, 4:18 am

Hi John,
Nice post, colours in excel have sucked for a long time, I agree 2007 is better.
I have some 1/2 decent colour tools, some in VBA some in .Net, my laptop die a while a go but if i can find a copy of the dll I will try very hard to knock up some sort of addin with all the bit togther - I’ll try and add you colour pallet idea too - it’s some thing I’ve been think about doing for a while also.
I’ll have a look tonight when i get home and try and send you what i have - if i can find it!
cheers
Ross

PS will link soon too. !


Comment from Sandy
Time: Thursday, February 21, 2008, 10:10 am

I couldn’t agree more, as just yesterday I received a copy of another seemingly expensive report that resulted from a roundtable think-tank on the education of technology. It included absolutely horrible charts.

Obviously we need people to read posts like this.

I’ve also written similar pieces (http://excelwithmonarch.com/xlreport/making-your-excel-reports-unique, and http://excelwithmonarch.com/xlreport/better-excel-color-management which also includes a free color tool for Excel).

Clearly the roundtable report authors didn’t read my piece. Here’s hoping they, and others like them, find yours.

Sandy


Comment from Jon Peltier
Time: Thursday, February 21, 2008, 11:33 am

Sandy - That looks like an extensive site you’re building. I’m not familiar with Monarch. From context, I can presume it’s some kind of data manipulation tool that can interact with Excel. Unfortunately I didn’t see any links to Monarch from your blog, even in the What’s Monarch section of your welcome post, other than the tucows link for the free download of the older version. Is it the product from DataWatch? Can you provide links to information about Monarch?


Comment from Sandy
Time: Thursday, February 21, 2008, 12:55 pm

Thanks Jon, the site’s coming along, though sometimes it feels like I have more ideas for the site than I do time.

I often refer to Monarch as a sort of universal data translator. It is published by Datawatch (http://monarch.datawatch.com/monarch-pro.asp).

While it does specialize in extracting data from report files, it can extract from Access and ODBC compliant databases, HTML files, PDF files and more, all without custom programming.

But for the adventurous types, Monarch offers a COM interface so you can automate your work with VBA. Even the command line accepts multiple parameters that are often enough to automate the work.

I have a couple of videos posted (more on the way) that show some of what Monarch does, and just how easy it is to work with.

One of the reasons that I started the site was because so many experienced Excel users such as yourself had never seen, much less even heard of Monarch, and I thought that I could, in fact should, help people get introduced to it.


Comment from alderaic
Time: Thursday, February 21, 2008, 2:35 pm

I did use monarch a lot to get old fixed width report multi line nightmares organized.

it is indeed very cool to use with VBA and worked line almost no other software did ie : no bugs no hassle, good manual, product support forum and easy to use functions.

on another note, wonderful post about color management, I definitely needed a tool to manage swatch tables, only one thing missing that I might do someday is saving the color table as well to define new combinations (often big companies have their own color charts for reporting so it can come in handy)

And a very interesting website to read (perceptual edge, didnt knw that one)

Thanks Jon,
another nice blog to read!


Comment from Jon Peltier
Time: Thursday, February 21, 2008, 3:05 pm

You could probably figure out how to add another custom palette. Set up another four column range anywhere on the Colors worksheet, define a worksheet-level name that refers to this range (the name is what is used in the listbox). Then list the color indices (1 to 56) and the corresponding red, green, and blue values for each index. Indices need not be in order, and any you do not list will revert to Excel’s default for that index.


Comment from Eric
Time: Friday, February 22, 2008, 1:21 pm

Nice work with the Palette Chooser, Jon!

I made some slight modifications to (attempt to) make it a little easier to define your own palette, although you still have to define the range name as you’ve said in the above post.

I modified the “Colors” sheet to show current colors, moved the indices to a single column, and permitted all the additional colors in the palette to be added quickly. Also, I modified the Apply button function to make it work.

Download here: http://www.savefile.com/files/1396679
(if anyone likes this, feel free to host it more permanently; this host only persists files for 30 days)


Comment from Eric
Time: Friday, February 22, 2008, 1:37 pm

Oops, Aqua’s color index should be 42, not 24!

Better download this version instead:

http://www.savefile.com/files/1396726


Comment from Jon Peltier
Time: Friday, February 22, 2008, 3:23 pm

I’ve made a good number of palette editors over the years. I built one (shown below) which allows partial but not full control, for a client with very specific requirements. I was thinking of punching it up to handle the entire palette, but with the release of Excel 2007, I though, why bother. The one I built for this article is not as interactive and not as visual, but it will in fact change any color in the palette.

Custom PaletteWizard

The above dialog went hand in hand with the following report formatting wizard, which allowed the user to select Excel objects (e.g., ranges, chart elements) and format them simply using the entire palette and using a quick two-click process. The colors that the palette wizard can modify are larger and have a dark outline in the report formatter. A dialog like this, on a modeless user form, would actually solve many issues with the loss of productivity introduced in Excel 2007. That gives me an idea….

Custom PaletteWizard

 

 


Comment from Nile
Time: Wednesday, February 27, 2008, 8:39 am

For your reference, here’s a ‘thermal gradient’ colour palette, running from ‘cold’ dark blues to ‘hot’ orange and red. This adds a lot to 3-d charts and surfaces, but it’s an effort to create all the colours in a sequence that presents constant ‘teps’ in colour: human colour perception isn’t a regular RGB sequence.

There’s a picture of it in use here:

http://pics.livejournal.com/hairyears/pic/000adesg

I’m not embedding the image in the text as it’s quite large.

The colur palette is created in code, but can certainly be captured and saved by your utility:

Set wbkNew = Application.Workbooks.Add

With wbkNew
‘Thermal Colour Gradient

.Colors(9) = CLng(”&H0060FF”)
.Colors(46) = CLng(”&H0080FF”)
.Colors(12) = CLng(”&H00A0FF”)
.Colors(10) = CLng(”&H00C0FF”)
.Colors(14) = CLng(”&H00D0FF”)
.Colors(5) = CLng(”&H00E0FF”)
.Colors(47) = CLng(”&H00F0FF”)
.Colors(3) = CLng(”&H00FFFF”)
.Colors(45) = CLng(”&H40FFE0″)
.Colors(43) = CLng(”&H80FFB8″)
.Colors(50) = CLng(”&HA0FF70″)
.Colors(42) = CLng(”&HE0F040″)
.Colors(41) = CLng(”&HFFE000″)
.Colors(13) = CLng(”&HF8D000″)
.Colors(7) = CLng(”&HF0C000″)
.Colors(44) = CLng(”&HE8B000″)
.Colors(6) = CLng(”&HE0A000″)
.Colors(4) = CLng(”&HD88000″)

.Colors(55) = CLng(”&HAA3030″)

‘Pale green colour gradient

.Colors(8) = &HD0E0B0
.Colors(33) = &HB0C090
.Colors(54) = &H90A070

‘Pale grey-blue colour gradient
.Colors(38) = &HFFF0D0
.Colors(40) = &HF0E0C0
.Colors(36) = &HE0D0B0
.Colors(35) = &HD0C0A0
.Colors(34) = &HC0B090
.Colors(37) = &HB0A080
.Colors(39) = &HA09070

‘medium violet colour gradient
.Colors(17) = &HFFE0F8
.Colors(18) = &HF0D0F0
.Colors(19) = &HE8C0E8
.Colors(20) = &HE0B0E0
.Colors(21) = &HD8A0D8
.Colors(22) = &HD090D0
.Colors(23) = &HC880B0
.Colors(24) = &HC07080

‘Pale grey colour gradient
.Colors(25) = &HF0F0F0
.Colors(26) = &HE0E0E0
.Colors(27) = &HD0D0D0
.Colors(28) = &HC0C0C0
.Colors(29) = &HB0B0B0
.Colors(30) = &HA0A0A0
.Colors(31) = &H909090
.Colors(32) = &H808080

Application.ScreenUpdating = True

End With


Comment from Fred L Johnson
Time: Wednesday, February 27, 2008, 4:56 pm

I’m still finding that the RGB function in VBA does not produce the color I specify using Excel 2007. The macro I wrote assigns the Interior color of a cell based upon variable values of R, G, and B. Excel 2003 seems to pick the nearest in the palette, but Excel 2007 seems to do the same thing. Is this a bug?


Comment from Jon Peltier
Time: Wednesday, February 27, 2008, 5:09 pm

Nile -

Thanks for the thermal gradient palette. I should try to include it in my little toy palette formatter.

Fred -

I really haven’t spent enough time with Office 2007’s color system to understand how it works. I’ve used it enough to be confused, but not enough to be frustrated. There are a couple of blog posts by Tony Jollans which discuss colors in Office 2007:

Colours in Word 2007, Part 1
Colours in Word 2007, Part 2

Tony has played with colors in Office 2007 enough to be frustrated, and finally enough to be knowledgeable.


Write a comment





Create Excel dashboards quickly with Plug-N-Play reports.