DataGraph Reference Manual
Print

Custom Legend

The Custom Legend command allows you to create a legend manually and has many options beyond the default Legend command.

Legend vs. Custom Legend

The Legend command automatically derives the legend entries based on the commands in the graph. You can customize the names and order of the entries, but the actual symbols and colors are generated automatically.

In the Custom Legend, you have complete control over the legend content. For example, you may want to specify which commands to include. You can also select precisely the symbols and colors the legend will display, add titles, or group the legend entries in categories.

The Custom Legend is also the only way to display color and marker schemes for a graph.

Add Custom Legend

The Custom Legend control object has to be added to a graph.

To add, select Command > Add Custom Legend from the menu bar or find the entry under the Label drop menu in the Toolbar.

When you first add a custom legend command, the location of a legend is indicated by the outline, but there are no entries in the box.

Expand the object by clicking the top left corner. Now, you can add elements to the legend.

Here, we added a Color scheme variable called Penguins.

You can also customize the width location.

Options

For more details on the options you have and the type of entries, please see the following sections.

Where

Use the Where menu to specify location of the legend. By default, the legend is inside the coordinate box, but you can locate it below, above, or to the right.

Width

Set the number of columns for the legend and the overall width in pixels.

Anchor

Where the anchor point is located.

Offset

Enter an offset in x and y direction in pixels.

Legend Title

Enter a title that will go at the top of the legend.

Add Entries

There are six different types of entries that you can add to the custom legend: 

  1. Command – entries based on a specified drawing command
  2. Point – a point that you can customize
  3. Color – a color that you can customize 
  4. Variable – the value for a variable, including color scheme variables 
  5. Pattern – a pattern that you can customize
  6. Text – a label that you can use as a divider between entries.

Use the Add menu to select an entry:

If you select Command, an entry is added where you can select from the commands in your graph. The Present menu gives you several options for what is displayed. 

Below, the same Plot command has been selected three times, but different options are displayed. The default shows the line and marker, but you can show only the marker or line color. The text corresponds to the Legend text entry from the command, similar to the standard Legend command.

Legend size

The size of the legend entry. Increases the space between the symbol and the text.

Spacing

Controls the vertical space between items.

Example

In the following example, four entries have been added.

  1. Label – “Species”
  2. Variable – Color scheme variable called penguins.
  3. Label – “Sex”
  4. Variable – Marker variable called ‘Sex’.

The custom legend has also been set up with a 2-column format in the lower right corner with a (0,0) offset.

Here is the resulting graphic.

On This Page