plot::Listplot

Finite lists of 2D points

Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

Syntax

plot::Listplot([y1, y2, …], <x = xmin .. xmax>, <a = amin .. amax>, options)
plot::Listplot(A1, <x = xmin .. xmax>, <a = amin .. amax>, options)
plot::Listplot([[x1, y1], [x2, y2], …], <a = amin .. amax>, options)
plot::Listplot(A2, <a = amin .. amax>, options)

Description

plot::Listplot serves for visualizing discrete data values [y1, y2, …]. If no range x = `x_{min}` .. `x_{max}` is specified, the data are plotted as the points [x1, y1], [x2, y2] etc. with equidistant x-values x1 = 1, x2 = 2 etc. If a range x = `x_{min}` .. `x_{max}` is specified, equidistant x-values between xmin and xmax are used.

If the data are specified as a list of coordinate pairs [[x1, y1], [x2, y2], …], plot::Listplot generates plot points with these coordinates.

With the attribute LinesVisible = TRUE, each pair of consecutive data points is connected by a curve.

With InterpolationStyle = Linear (default), the points are connected by straight line segments.

With InterpolationStyle = Cubic, a cubic spline curve is used to connect the points. The spline curve between two data points is rendered as a collection of m + 1 straight line segments, where m is specified by the attribute Submesh = m.

Use LinesVisible = FALSE, if only the data points without connecting lines are to be rendered.

Attributes

AttributePurposeDefault Value
AffectViewingBoxinfluence of objects on the ViewingBox of a sceneTRUE
AntiAliasedantialiased lines and points?TRUE
Datathe (statistical) data to plot 
FillColorDirectionthe direction of color transitions on surfaces[0, 0]
Framesthe number of frames in an animation50
InterpolationStyleinterpolation via linear or cubic splinesLinear
Legendmakes a legend entry 
LegendTextshort explanatory text for legend 
LegendEntryadd this object to the legend?FALSE
LineColorcolor of linesRGB::Blue
LineWidthwidth of lines0.35
LineColor2color of linesRGB::DeepPink
LineStylesolid, dashed or dotted lines?Solid
LinesVisiblevisibility of linesTRUE
LineColorTypeline coloring typesFlat
LineColorFunctionfunctional line coloring 
LineColorDirectionthe direction of color transitions on lines[0, 1]
LineColorDirectionXx-component of the direction of color transitions on lines0
LineColorDirectionYy-component of the direction of color transitions on lines1
LineColorDirectionZz-component of the direction of color transitions on lines1
Namethe name of a plot object (for browser and legend) 
ParameterEndend value of the animation parameter 
ParameterNamename of the animation parameter 
ParameterBegininitial value of the animation parameter 
ParameterRangerange of the animation parameter 
PointSizethe size of points1.5
PointColorthe color of pointsRGB::Black
PointStylethe presentation style of pointsFilledCircles
PointsVisiblevisibility of mesh pointsTRUE
Submeshdensity of submesh (additional sample points)6
TimeEndend time of the animation10.0
TimeBeginstart time of the animation0.0
TimeRangethe real time span of an animation0.0 .. 10.0
Titleobject title 
TitleFontfont of object titles[" sans-serif ", 11]
TitlePositionposition of object titles 
TitleAlignmenthorizontal alignment of titles w.r.t. their coordinatesCenter
TitlePositionXposition of object titles, x component 
TitlePositionYposition of object titles, y component 
VisiblevisibilityTRUE
VisibleAfterobject visible after this time value 
VisibleBeforeobject visible until this time value 
VisibleFromToobject visible during this time range 
VisibleAfterEndobject visible after its animation time ended?TRUE
VisibleBeforeBeginobject visible before its animation time starts?TRUE
XMaxfinal value of parameter "x" 
XMininitial value of parameter "x" 
XNamename of parameter "x" 
XRangerange of parameter "x" 
XSubmeshdensity of additional sample points for parameter "x"6

Examples

Example 1

We plot 5 discrete data values as points with equidistant x-values 1, 2, 3, 4, 5:

plot(plot::Listplot([1, 0, 1, 0, 1]))

We plot two data samples and place them side by side by specifing suitable ranges for the horizontal variable:

plot(plot::Listplot([1, 0, 2, 1], x = 0..1, Color = RGB::Red),
     plot::Listplot([0, 1, 0, 2], x = 1..2, Color = RGB::Blue))

We specify x-coordinates for the data points:

plot(plot::Listplot([[0.1, 1], [0.15, 0], [0.2, 1], 
                     [0.3, 0], [0.5, 1]]))

Example 2

We demonstrate the difference between linear and cubic spline interpolation:

plot(plot::Listplot([10, 0, 20, 0, 30], Color = RGB::Red,
                     InterpolationStyle = Linear),
     plot::Listplot([10, 0, 20, 0, 30], Color = RGB::Blue,
                    InterpolationStyle = Cubic))

We smoothen the cubic spline curve by increasing the Submesh value:

plot(plot::Listplot([10, 0, 20, 0, 30], Color = RGB::Red,
                     InterpolationStyle = Linear),
     plot::Listplot([10, 0, 20, 0, 30], Color = RGB::Blue,
                    InterpolationStyle = Cubic, Submesh = 12))

Example 3

A random variable describing the number of successes in n Bernoulli trials with success probability p is binomially distributed with expectation value np and variance np (1 - p). For large values of n, the binomial distribution is approximated by a corresponding normal distribution.

We use plot::Listplot to visualize the discrete probability values of the binomial distribution. The normal distribution is visualized via plot::Function2d:

n := 10: p:= 0.4:
plot(plot::Listplot([stats::binomialPF(n, p)(i) $ i = 0..n], 
                     x = 0..n, Color = RGB::Red),
     plot::Function2d(stats::normalPDF(n*p, n*p*(1 - p))(x), 
                      x = 0..n, Color = RGB::Blue)):

delete n, p:

Parameters

y1, y2, …

Vertical coordinates: numerical values or expressions of the animation parameter a.

y1, y2, … is equivalent to the attribute Data.

x

Name of the horizontal coordinate: an identifier or an indexed identifier. It is used as the title of the coordinate axis in x direction.

x is equivalent to the attribute XName.

xmin .. xmax

The range of the horizontal coordinate: xmin, xmax must be numerical real value or expressions of the animation parameter a.

xmin .. xmax is equivalent to the attributes XRange, XMin, XMax.

A1

A 1-dimensional array of domain type DOM_ARRAY or a matrix of category Cat::Matrix (e.g., of type matrix or densematrix) with 1 row or 1 column. The entries must be numerical real values or arithmetical expressions of the animation parameter a. The entries in A1 are regarded as data values [y1, y2] etc..

A1 is equivalent to the attribute Data.

x1, x2, …

Horizontal coordinates: numerical values or expressions of the animation parameter a.

A2

A 2-dimensional array of domain type DOM_ARRAY or a matrix of category Cat::Matrix (e.g., of type matrix or densematrix) with at least two rows and two columns. The entries must be numerical real values or arithmetical expressions of the animation parameter a. The i-th row is regarded as the data point (xi, yi). If more than 2 columns are provided, only the data in the first two columns are considered; all additional columns are ignored.

A2 is equivalent to the attribute Data.

a

Animation parameter, specified as a = amin..amax, where amin is the initial parameter value, and amax is the final parameter value.

See Also

MuPAD Functions

MuPAD Graphical Primitives

Was this topic helpful?