Documentation Center

  • Trial Software
  • Product Updates

LegendAlignment, LegendPlacement, LegendVisible

Legend at left, center, or right

Value Summary

LegendAlignmentInheritedCenter, Left, or Right
LegendPlacementInheritedBottom, or Top
LegendVisibleInheritedFALSE, or TRUE

Graphics Primitives

ObjectsDefault Values
plot::Scene2d, plot::Scene3d

LegendAlignment: Center

LegendPlacement: Bottom

LegendVisible: FALSE

Description

LegendVisible activates a legend identifying the individual objects in a plot.

LegendAlignment and LegendPlacement control the placement of this legend.

For complex plots with multiple objects, it is often helpful to include an explanation in form of a legend that states the connection from object color to object meaning.

The entry for "object meaning" is usually not provided automatically but must be given using LegendText. As an exception, plotfunc2d and plotfunc3d set the function terms as "meaning". Cf. Example 1.

Using LegendPlacement, the legend can be moved from below the plot to above it. LegendAlignment controls whether the legend is displayed flush left, flush right, or centered (which is the default).

Examples

Example 1

When plotting more than one object, plotfunc2d and plotfunc3d set LegendVisible = TRUE:

plotfunc2d(sin(x), cos(x))

It is possible to explicitly switch this automatic legend off:

plotfunc2d(sin(x), cos(x), LegendVisible = FALSE)

Using LegendPlacement and LegendAlignment, we place the legend in the upper right corner of the graphics:

plotfunc2d(sin(x), cos(x),
           LegendPlacement = Top, LegendAlignment = Right)

Example 2

When plotting many objects with active legend entries, the legend is abbreviated: It will never take up more than half of the scene height and it will not contain more than 20 entries:

plotfunc2d(-i*x^3+i/10*x^2+x-i $ i = -15..15, x=-1..1)

plotfunc2d(-i*x^3+i/10*x^2+x-i $ i = -15..15, x=-1..1,
           Height = 15*unit::cm)

See Also

MuPAD Functions

Was this topic helpful?