Legends in Excel Charts – Formats, Size, Shape, and Position
by Jon Peltier
Monday, February 9th, 2009
Peltier Technical Services, Inc., Copyright © 2010.
Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
Most charts use some kind of legend to help readers decode the charted data. Excel charts have legends by default, and these legends have a great deal of flexibility (as well as some frustrating constraints).
The best legend is actually no legend at all. A legend by its very nature is somewhat separated from the chart, so a reader must move his eyes back and forth to decode the chart. Placing labels directly on or adjacent to the plotted data is more effective, but it can be more work, and for charts with a lot of data that’s entangled together, data labels may not be practical.
Legend Formatting
The default formatting for the borders in a chart is black. The plot area is also filled with a muddy gray color, but I’ve removed that already.

That’s so many dark lines that I forget I’m supposed to look there for some data. This can be improved by removing the outermost border and using a light gray for the plot area and legend borders.

In fact, that’s still too many visible lines, but I’ll use the light gray in this article so the outlines of the plot and legend are clear.
Without any extraneous borders at all, the data stands out in the chart. Ah, now that’s why we made a graph, to show the data.

The problem with a legend is that it’s somewhat removed from the data. You can move the legend so it’s more integrated into the chart.

You could even tweak the colors in the legend, to make the legend blend in.

Of course, the best legend at all is no legend. Identify the data instead with labels attached to the data series.

The labels are a bit close together, but matching their text colors to the series colors improves the separation between adjacent labels.

Legend Placement
The Excel 2003 Format Legend dialog is shown below, with the Placement tab visible. There are five predefined placements, and the default placement is Right.

Here is a chart with the legend in the default Right position.

This chart has its legend in the awkward Left position. If the value axis were on the opposite side of the chart, this would not be so awkward.

This legend is at the top of the chart.

This legend is at the bottom of the chart. This is probably less effective than the top position, because the horizontal axis comes between the legend and the chart it describes.

This legend is in the least useful corner position. Even Excel knows this is an untenable position. When this position is selected, the chart scrunches up into the opposite corner, and the chart’s text autoshrinks to 5.5 pt. When you change the font to a legible size, like 8 pt, the legend moves to near the right position and the chart itself expands to its original size.

The default placements, at least right and top, are okay. But Excel leaves too much space around the legend and between the legend and the rest of the chart. I start with a default legend position, then reposition and resize the legend to suit my tastes.
Automatic Resizing and Rearranging of the Legend
Let’s return to the the Top position to see a few characteristics of the legend. The legend entries are evenly distributed across the legend.

Suppose the labelsin the legend entries different lengths. All of the entries move to maintain a nice distribution.

If the legend entries are about the same width, but the chart itself cannot accommodate them all, Excel wraps them to fit.

Manually Resizing and Rearranging the Legend
When you select the legend, its edges and corners are highlighted with the familiar handles that allow resizing.

When you begin resizing the legend, the boundaries around the legend entries are displayed.

As this legend is made narrower, the first legend entry wraps to two lines. The other legend entries assume the same dimensions as the largest one, and to accommodate the taller entries, the last one is pushed below the bottom edge of the legend.

When the mouse is released, only five entries are visible.

The legend has to be stretched downward to provide room for the last entry.

Now they all fit, but the spacing doesn’t look very nice. Unless all legend entries have to wrap, it’s probably better to make the legend wide enough to prevent wrapping.

As soon as the legend is being manually resized, all legend entries assume the same dimensions. The other five entries in this legend forget that they had resized themselves to accommodate the longer “one hundred” label.

This legend has been rearranged into a 2 row by three column grid.

This legend has been resized to a 3 row by 2 column grid.

By default, the entries are listed in order, filling rows first, then columns. For example, the entries for one and two are side by side.

If you’d like the entries to be listed in order filling columns then rows, with one above two above three, you need to rearrange the order of series in the chart. Series one is plotted first, four second, two third, five fourth, and so on.

Follow up posts in the blog: Legend Entry Tricks in Excel Charts, which will feature formatting tricks enabled by the individual entries in a chart legend, Order of Legend Entries in Excel Charts, which will describe some of the intricacies of legend entry order, and Double Legend in a Single Chart, which shows a dummy series approach to adding multiple legends in a chart.
Related Posts:
- Legend Entry Tricks in Excel Charts
- Order of Legend Entries in Excel Charts
- 9 Steps to Simpler Chart Formatting
- Double Legend in a Single Chart
- Stack Columns In Order Of Size
- Category Labels That Don’t Overlap the Data
- Yikes! Another Pie Horror Show
- Magazine Quality Chart (Economist)
- Draw an Axis With Tick Marks But No Line
- Tax the Rich, or Deceptive Axis Scales
Posted: Monday, February 9th, 2009 under Formatting.
Comments: 7
Comments
Comment from SpeedBall
Time: Monday, February 9, 2009, 7:47 am
Hey- like your posts!
I’ve been trying to figure out since a long time but how do we get away with legend and use labels instead? When I use data labels in chart wizard(/options) the labels get attached to each data point instead of how neatly they’re displayed in your chart…
Any help?
thanks
Comment from Jon Peltier
Time: Monday, February 9, 2009, 7:57 am
Hi SpeedBall -
Thanks for the comment. In answer to your question, I use a very simple routine to label the last point of each series in the chart. It can be found in two places, in my blog at Label Each Series in a Chart, and on my tutorial site at Label the Last Point in an Excel Chart’s Series, where there is more discussion about the technique and development of the code.
Comment from Jerry Betz
Time: Monday, February 9, 2009, 10:58 am
Jon,
I have found difficulty in ordering legend entries via automation in VBA, especially if the chart has a dual Axis. I have macros that update the legend if an option box is selected to display the series. It may be a limitation of Excel 2003, but the series for one axis will be grouped first, then the series for the second axis. When selecting a series object, and trying to re-order the series on the Series Order Tab in the Format Data Series dialog box, only series for the axis in which it is ascribed to can be re-ordered. Perhaps this is a feature that I should learn to embrace.
I utilize your techniques in setting up Dummy Series in the construction of charts, I wish there was a way to select an option in a dialog box to tell Excel to omit these series from Chart Legends. This would make macros that customizing legends easier, especially in dual-axis charts.
Thank you for sharing in all of these posts, and for personally helping me out in other posts (http://www.dailydoseofexcel.com/archives/2008/08/15/my-coding-technique/).
Comment from Jon Peltier
Time: Monday, February 9, 2009, 12:40 pm
Hi Jerry -
Working with legend entries in VBA is a challenge, because there is not a linkage between a series and its legend entry. We have suggested this for future developments of Excel by Microsoft. A legend object model linked to the series collection would be outrageous.
Reordering is actually only possible within a chart group, which is a collection of series of a given type and on a given axis. This is more constrained than you mentioned, but if you’ve never tried this on a combination chart, you would not have run up against it.
I talk about chart groups in a future post, the one talking about legend entry order. Wednesday, I think.
Comment from SpeedBall
Time: Tuesday, February 10, 2009, 6:24 am
Thanks a lot Jon!! you rock!
Comment from SpeedBall
Time: Tuesday, February 10, 2009, 7:15 am
My data required me to put the labels at the start of the series (the series are converging in the end) which made the data labels to overlay on themselves.
I’ve added following bit of code for it to decide on its own what is the best place to put labels (start or end)…decision is based on stdev of the first and last data values.
Dim xrange1, xrange2 As Variant
If ActiveChart Is Nothing Then
MsgBox "Select a chart and try again.", vbExclamation, "No Chart Selected"
Exit Sub
Else
k = 0
tot = ActiveChart.SeriesCollection.Count
ReDim xrange1(1 To 1, 1 To tot)
ReDim xrange2(1 To 1, 1 To tot)
For Each mySrs In ActiveChart.SeriesCollection
k = k + 1
xrange1(1, k) = mySrs.Values(1)
xrange2(1, k) = mySrs.Values(mySrs.Points.Count)
Next mySrs
stdev1 = WorksheetFunction.StDev(xrange1)
stdev2 = WorksheetFunction.StDev(xrange2)
For Each mySrs In ActiveChart.SeriesCollection
bLabeled = False
With mySrs
ptcount = .Points.Count
If stdev1 > stdev2 Then
startpt = 1
endpt = ptcount
xstp = 1
Else
startpt = ptcount
endpt = 1
xstp = -1
End If
For iPts = startpt To endpt Step xstp
Comment from Jon Peltier
Time: Tuesday, February 10, 2009, 7:53 am
SpeedBall -
Great idea. I may just post that as a complete routine when I have a chance.



















Write a comment
I welcome comments from my readers. If you have an opinion on this post, if you have a question or if there is anything to add, I want to hear from you. Whether you agree or disagree, please join the discussion.
If you want to include an image in your comment, post it on your own site or on one of the many free image sharing sites, and include a link in your comment. I'll download your image and insert the necessary html to display the image inline.
Read the PTS Blog Comment Policy.