This topic is a companion to the main Legends topic. Please review the Legends topic before proceeding with this topic. This topic shows the creation of legends in a layout. If we turn on the virtual Legends layer in the Layers pane for a map window, the dynamic legend thus created will show entries for rasters the same way.
We will create a legend for a map of Monaco that has four layers: a background layer of Bing streets, plus three drawing layers with a Railways layer, a Roads layer, and a Buildings layer. The data comes from OpenStreetMap.
The Railways layer has a fixed format for all lines, while the Roads layer and the Buildings layer have thematic formats for lines and areas respectively. Buildings areas are styled by the area of the building, based on an Area field that is a computed field. Roads lines are styled using an fclass field, which is an OpenStreetMap attribute giving the class of road.
We create a layout, open the layout, and then drag and drop the map into the layout as a new map frame.
The map appears in a new layout frame as seen below.
With the focus on the layout, the Layers pane shows only one frame in the layout, the frame showing the map. The Layers pane is seen below as an undocked pane.
We begin by creating a dynamic legend frame in the layout. We can then convert that dynamic legend to a collection of static legend frames, to which we can add more frames and customize the frames as we like.
In the main toolbar, within the Cursor / command mode button, we choose Create Legend.
In the layout we click where we would like the approximate center of the legend to be.
A dynamic legend frame appears at that location with a default legend in the frame.
The legend will take its contents from the topmost map frame under the legend, automatically including or excluding layers depending on the legend mode set for layers in the map used in that topmost frame. The legend shows the thematic formatting for the Buildings and Roads layers and the style for the Railways layer.
The new frame is picked as the active frame for editing, as if we had alt-clicked it, so that we can immediately edit the legend if we want. The Info pane pops open to the Style tab so we can edit the Legend. We can resize and reposition the legend frame as desired, or click again to create another legend frame.
When we are finished creating legend frames we should choose the Default + cursor tool in the main toolbar to exit Create Legend mode. We do that right away, so that when we click into the Layout we do not end up creating another legend.
Keyboard shortcut: Press Shift-Esc to get back to Default navigation mode.
A new Legend frame also appears in the Layers pane for the layout window.
The simple dynamic legend created by default is useful for many purposes as is. We can customize it using four main techniques:
We begin by making the legend narrower.
We drag an edit handle on the frame to make the legend frame narrower.
Next, we alt-click the map frame to pick it, so we can resize the map to make it smaller, so the legend can appear with white space around it in the printed layout, without the visual clutter of the map behind it.
Alt-clicking the map frame picks it for editing, and also unpicks the the legend frame. We can now drag edit handles on the map frame to resize the map.
We resize the map to make it narrower, which frees up whitespace to the left of the layouts page.
We alt-click the legend frame to pick it...
...and then we drag the legend frame a bit to the right and down to position it away from the paper margin and more to the vertical center of the page.
To get a better look at the legend, we will zoom into the layout window, using a right click and drag zoom box.
We will now adjust formatting within the legend by using the Legend dialog.
When we picked the legend frame with an alt-click, the Info pane automatically switched to the picked legend frame as its context. To launch the Legend dialog we click the [...] browse button.
In the Legend dialog, we change the font for Text to a bold font. We also change the font for Single legend entries to a bold font. We change the Padding to a value of 10, to provide more space between the legend contents and the border of the legend. The changes have been noted in the illustration above with magenta arrows. The preview pane shows the changes that will occur, using a schematic legend as an example.
Press OK.
Back in the Info pane, press Update Frame to apply the changes to the legend frame.
The legend adjusts to using the new, boldfaced font and to provide more padding between the legend contents and the border of the legend.
We pause for a moment to note that the legend is still a dynamic legend. It will automatically adapt to changes in the map window, such as changes to style or changes to the order or visibility of layers.
For example, in the map window we can drag the Railways layer tab from below the Roads layer to the topmost (leftmost in the tab strip) position in the display stack.
The legend immediately rearranges itself to place the legend entry for the Railways layer at the top of the legend, so the legend entries continue to be in the same order as the display stack.
Looking at the sample for the Railways layer, we might want to use a fill color other than white for the legend, so the alternating black and white colors used for rail lines are more apparent. Alternately, in the map window that is the source for the map frame in the layout, we could change the style for the Railways layer to use fine borders for the rail lines so the sample will be bounded with black lines.
Converting the dynamic legend frame, a single frame, into a ensemble of static legend frames is easy.
With the focus on the layout window, in the the Layers pane right-click onto the Legend entry and in the context menu choose Split into Samples. That creates a collection of individual frames that collectively reproduce the look of the dynamic legend. All of the new frames are placed within a new Legend folder so they can be selected and turned off and on together. The original Legend is not deleted, but simply turned off, ready for use if we need it again.
The last frame created in the Legend folder, with a small Ab icon, is the blank text frame that is the base frame. The other frames are either text frames used as various captions, or sample frames, showing area or line symbology.
By default, layouts show margin lines so we can see the boundaries of frames and the paper margins used for the layout.
We can click the Margins button to turn off display of margins, to see how the layout would be printed. That shows us the typical, default formatting used for legends, where the base layer has a thin, black border line and other frames do not use borders.
We click the Margins button again, to turn margins back on. It is easier to work with frames when we can see their boundaries.
Next, we will edit the Buildings : Area and Roads: fclass text frames, which provide a caption reporting the field on which thematic formatting is based for the Buildings and Roads layers respectively, to use more natural language.
To do that, we will alt-click each frame in turn and then edit it.
In the Layers pane we Alt-click the Buildings : Area frame to pick it as the active frame. Alternatively, in the Layers pane we could right-click tthe Buildings : Area frame and then choose Active in the context menu that pops up, to pick it as the active frame.
In the Info pane we change the text to Buildings by Area. Press Update Frame.
Next, we alt-click the Roads : fclass frame and then in the Info pane we change the text for that frame to Roads by fclass. Press Update Frame.
We see the results above. However, the bold text captions seem cramped. We would like to make their frames taller than the other frames, to provide more vertical room.
We take a moment to turn off the base frame, the lowest frame within the Legend folder, by clicking the visibility button for that frame in the Layers pane. If the frame is turned off it cannot be selected by accident with a Ctrl-click in the layout. Turning off the frame also eliminates the visual clutter of the base frame's border. Many users turn off the base frame while they tinker with other frames in a legend.
Next, we Alt-click the Railways frame to pick it as the active frame.
We resize the Railways frame, to make it larger vertically, by dragging the upper edit handle upwards.
Either in the Layout window or in the Layers pane, we Ctrl-click the Buildings by Areas and Roads by fclass frames to select them.
In the Alignment commands toolbar button menu, we choose Same Height to resize all selected frames to the same height as the active frame. This will resize the selected Buildings by Areas and Roads by fclass frames to the same height as the Railways frame, which is still the active frame.
That increases the vertical height of the the selected Buildings by Areas and Roads by fclass frames to the same height as the Railways frame. However, these now overlap some of the other frames. We need to restack the frames vertically.
In the Layers frame wee select all the frames except the Railways frame and the base frame. The quickest way to do that is to first do Shift-Ctrl-A to deselect all frames, then Ctrl-click on the Buildings by Areas frame to select it, and then Shift-Ctrl-click on the track frame to select it and all of the frames between the track frame and the Buildings by Area frame. That is quicker with many frames than tediously ctrl-clicking each frame to select it.
With the focus on the Layout window, in the Alignment commands toolbar button menu, we choose Stack Vertical to stack the selected frames vertically around the active frame, preserving the same stack order as the top to bottom display stack order shown in the Layers pane.
The active frame, the Railways frame, stays in the same position and the selected frames are stacked vertically so they do not overlap but are exactly adjacent.
With the focus on the Layout window we press Shift-Ctrl-A to deselect all of the frames, then we press Esc or Alt-click outside any of the frames to unpick the Railways frame so it is no longer the active frame.
Click the Margins button to turn off display of margins, to see how the layout would be printed. That produces the display seen above. The legend is now less cramped, since we have expanded the vertical size of frames used for captions.
However, we have not yet resized and aligned the base frame to match the new size of the frame in the legend.
We click the Margins button again, to turn margins back on, and in the Layers pane we turn on the base frame.
We will use the Resize to Selected alignment command to resize the base frame to the rest of the frames. To do that we first select all of the rest of the frames and then we make the base frame the active frame. That is most convenient to do in the Layers pane.
In the Layers pane we Ctrl-click the Railways frame to select it and then we Shift-Ctrl-click the track frame to select the track frame and all the frames in between. We then Right-click the base frame and choose Active to pick that frame as the active frame.
The layout window shows the selected frames, and also the base frame we picked as the active frame. We can see that the base frame is not aligned to the other frames. We can align it and resize it with a single click using the Resize to Selected command in the Alignment commands toolbar button menu:
In the Alignment commands toolbar button menu, choose Resize to Selected. That will resize and align the active frame to the selected frames.
Alignment commands work by altering or moving all selected frames to match the active frame. The Resize to Selected command is the exception: it alters the active frame to match all selected frames.
In the layout window, the base frame immediately resizes and aligns to match the selected frames.
That is good in terms of alignment, but we would like to make the base frame larger by 10 points on all sides, to match the 10 point padding that was used in the original Legend. We can do that using the Position tab in the Info pane.
Choosing the Position tab in the Info pane, which still shows the base frame as the context because the base frame is still the active frame, we can see the numbers for the locations of the Left and Bottom edges of the base frame, as well as the X and Y size of the base frame.
We edit the numbers so that the Size numbers are 20 points larger (ten points for margins on either side and above and below), and we edit the numbers so the Left / Bottom numbers are 10 points smaller. That makes the base frame 20 points larger overall in height and width, and at the same time it moves the base frame to the left and down by 10 points so that the increased height and width is split up into an extra 10 points of space on all sides around the frames within the base frame.
Press Update Frame.
The base frame immediately resizes to be 20 points larger in height and width, and also to move 20 points to the left and down, so it is centered on the selected frames within.
With the focus on the layout window, we press Esc to unpick the active frame, so there are no longer blue editing handles. We press Shift-Ctrl-A to deselect all frames.
We click the Margins button to turn off display of margins. That produces the display above showing how the layout will look when printed.
The legend now is more open, since we have expanded the vertical size of frames used for captions, and it is also bounded by a border that shows the outline of the aligned, resized, and expanded base frame.
If we like, we can add a text frame to the legend ensemble, to provide a title caption.
In the main toolbar, within the Cursor / command mode button, we choose Create Text.
In the illustration below, we have clicked the Margins button again, to turn margins back on. It is easier to work with frames when we can see their boundaries.
In the layout we click where we would like the approximate center of the new text frame to be. We are going to resize and align the text frame so there is no need to be precise.
A new text frame appears at that location with a default text in the frame. The new text frame is picked as the active frame for editing, as if we had alt-clicked it, so that we can immediately edit the text if we want in the Info pane. The Info pane pops open to the Style tab so we can edit the text. We can resize and reposition the textframe as desired. In the illustration above, we have already slightly resized the frame vertically, so it is about the height we think we want for the caption frame. We have not resized it horizontally.
When we are finished creating text frames we should choose the Default + cursor tool in the main toolbar to exit Create Text mode. We do that right away, so that when we click into the Layout we do not end up creating another text frame.
Keyboard shortcut: Press Shift-Esc to get back to Default navigation mode.
In the Info pane we choose black for the Background color. In the text style controls, we choose white for the stroke color and we choose a boldfaced font. In the text box we enter Monaco for the text.
Press Update Frame.
That fills the text box with a black background and uses white, boldfaced text for the Monaco text.
We will now make the new Monaco text frame the same width as the base frame, we will align it to the base frame, and we will stack it immediately on top of the base frame.
To do that, we will use the Alignment commands. We will make the base frame the active frame, and the Monaco text frame the selected frame, so the commands operate to make the Monaco frame match the base frame.
We use the Layers pane to quickly select the Monaco frame and to make the base frame the active frame.
In the Layers pane, Ctrl-click the Monaco frame to select it. Right-click on the base frame at the bottom of the stack within the Legend folder, and choose Active to make it the active frame. If desired, we could have selected the Monaco frame by Ctrl-clicking it in the Layout window, and we could have picked the base frame by Alt-clicking it in the Layout window.
That sets up the Layout window to work with the alignment commands.
In the Alignment commands toolbar button menu, choose Same Width. That resizes the selected Monaco frame so it is the same width as the active, base frame.
The frame is resized on the same center location. We will now align it so it is precisely above and in line with the active frame below.
In the Alignment commands toolbar button menu, choose Align Center Horizontal. That moves the selected Monaco frame so it is horizontally aligned to the center of the active, base frame.
The Monaco frame is now the same width as the base frame below, and it is aligned to be directly above it. We will now stack it precisely onto the top of the base frame.
With the focus on the Layout window, in the Alignment commands toolbar button menu, we choose Stack Vertical. That stacks the selected Monaco frame vertically down to the active, base frame.
The last three alignment commands we used are very quick to do. An experienced user applies them one after the other in a few seconds. Beginners will take some time to get used to using those commands, but once they are learned they go very quickly.
We click the Margins button to turn off display of margins, to see how the layout would be printed. We also press Esc to unpick the base frame, and Shift-Ctrl-A to deselect the Monaco frame.
The visual result is a legend that we have customized to our liking. We started with dynamic legend that we created with one click and then split into samples, so we did not need to manually create all of the sample frames.
Style overrides excluded - Legends created using Create Legends will capture formatting in the Style pane, but will not capture style overrides used to style objects individually if such have been applied.
Example: Layout Properties - Editing properties which appear in the mfd_meta table for a layout changes the content of that layout. We can exploit that effect to create standardized layouts which are then re-cycled for different content.