This topic is a companion to the main Legends topic. Please review the Legends topic and the Legends: Tutorial Example 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.
Images in Manifold are for all sorts of raster data, and are also called rasters. When we create add a dynamic legend to a layout using Create Legend for a frame created from an image, the legend created depends on the type of image.
Legends created for single-channel images, such as rasters that show terrain elevation surfaces can be very useful. Dynamic, automatically-created legends for palette (indexed) images sometimes can be useful given some tinker time. Dynamic legends created for RGB photographic images are not useful, are not provided, and are better replaced with a caption using a text frame.
Single channel images typically display data, such as terrain elevation, temperatures or other data shown in a heat map display. The dynamic legend will be created based on the Style intervals used to style the image.
In this example we use a single channel raster called Hills that shows terrain elevations near Livermore, California, using the Style shown above.
Suppose we drag and drop that drawing into a new layout, where it is the only frame.
To add a legend, with the focus on the Layout window in the main toolbar, within the Cursor / command mode button, we choose Create Legend.
Click into the layout approximately where we would like the new legend frame to be created. We do not have to be precise, since we can always drag the legend to the precise location we want. In this example, we click to create the new legend to the left of the image frame, and not immediately above the image frame.
Dynamic legends take their content from whatever is the uppermost frame below them in the display stack. If no frame is directly below the legend, the legend will take its contents from whatever is the uppermost frame in the layout. In this case, there is only one frame in the layout, an image frame, so we can create the new legend anywhere in the layout and it will take its contents from that image frame. We create the legend off to one side so there is no background clutter from the image frame to distract the eye from the legend.
A new, dynamic legend frame appears in the layout. 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.
The actual frame, shown in blue, picked color with editing handles, is larger than the dynamic legend it contains. That allows the dynamic legend room to expand to additional rows without them being clipped if we change the style used for the image to result in more rows.
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.
The dynamic legend that is created with a single click is simple, but still useful. We can customize it using the methods shown in the Legends: Tutorial Example topic. For example, we might want to change the caption from Hills to Hills, Elevation.
We can also, of course, resize the legend frame to narrow the legend and to drag it to a different location in the layout, as seen above.
Palette images reduce the number of colors used in the image to 256 colors and then using one number per pixel (one channel) to specify the color for each pixel. Each color number corresponds to a color in a palette of 256 colors. Each color in the palette is an RGB color out of a possible range of millions of colors. Besides saving space, an important raster data usage of palettes is to force pixels into a pre-defined set of color values. Such values can represent various classification schemes for the physical regions or data values represented by the pixels. Palette images are known as indexed color mode images in Adobe PhotoShop.
When creating a dynamic legend automatically for a frame that contains an palette image, the system will create 256 sample lines in the legend, one for each possible color used. That is almost always far too much, so we convert the dynamic legend into a collection of static legend frames using the Split into Samples command, and then we delete the the sample frames we don't need. Since it is easier to select and quickly delete many frames, that is easier than adding many legend frames manually to a collection of static legend frames.
We take a sample image that is a palette image using eight colors, originally saved in .png format and imported into Manifold. Once imported into Manifold even though only eight colors are used from the available 256 color slots in the palette, the palette image is set up with a 256 color palette. All of the colors after the first 8 are black.
Using Create Legend creates a very long legend with most of the lower legend entries clipped (not shown) for lack of vertical space. Only 23 color entries are shown. We can see that eight colors, from 0 to 7, are used by the image.
The default legend is also too wide for our tastes. We will customize it slightly.
In the Info pane we click the [...] browse button to launch the Legend dialog.
In the Legend dialog we change the alignment for Text and Multiple frames to center. We change the Padding to 10 to provide more white space around the legend entries and the border of the legend.
Press OK.
Back in the Info pane, press Update Frame to apply the changes.
In the above illustration we have also dragged the edit handles on the side of the frame to make the frame narrower. We have also dragged the frame to a lower position in the layout.
We now will convert the legend to a collection of static frames, and then delete unnecessary frames, from 8 onward.
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 color samples used in the raster style. There are only 20 color samples shown (clipping the last two due to rounding). The system knows there is no point in creating individual sample frames for parts of the dynamic legend that were clipped for lack of space and not shown in the dynamic legend.
The layout window shows how the single legend frame used by the dynamic legend has been replaced by many smaller frames, most of them being sample frames. We will delete all of the sample frames from 8 to 19.
That is most easily done in the Layers pane.
We Ctrl-click the 8 frame to select it, and then we Shift-Ctrl-click on the 19 frame. That selects it and all frames in between as well. We press the Delete button in the toolbar to delete the unwanted frames.
That reduces the legend down to a small size. The legend now shows the colors used in the image, and the index number for each color.
However, the base frame is now much larger than the smaller frames within. We can use an alignment command to resize it to the size of the smaller frames within.
With the focus on the layout window, in the Layers pane we select all of the frames from the bronze_8_palette text frame to the 7 frame. We right-click the Ab base frame and choose Active to pick it as the active frame.
We can see in the layout window how that picks the base frame as the active frame and also selects all the other frames.
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.
The base frame instantly resizes to match the size of the selected frames.
However, that loses the 10 point padding that was added to the size of the base frame to provide some more space between the base frame's border and the inner frames. We can expand the base frame by using the Position tab in the Info pane.
Choosing the Position tab in the Info pane, which shows the base frame as the context because the base frame is 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 shows entries only for the palette values that are used, and it is also bounded by a border that shows the outline of the aligned and expanded base frame.
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.