Skip to Main Content Skip to Search
Product Documentation

plot::Listplotfinite lists of 2D points

plot::Listplot holds a list [y_1, y_2, Symbol::dots] of y-values, which are visualized as 2D points with equidistant x-values. Alternatively, a list [[x_1, y_1], [x_2, y_2], Symbol::dots] of 2D points with given x- and y-coordinates can be specified.

→ Examples

Calls:

plot::Listplot([y1, y2, ...], <x = `x_{min}` .. `x_{max}`>, <a = amin .. amax>, Options)

plot::Listplot(A1, <x = `x_{min}` .. `x_{max}`>, <a = amin .. amax>, Options)

plot::Listplot([[x1, y1], [x2, y2], ...], <a = amin .. amax>, Options)

plot::Listplot(A2, <a = amin .. amax>, Options)

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.

`x_{min}` .. `x_{max}`

the range of the horizontal coordinate: xmin, xmax must be numerical real value or expressions of the animation parameter a
`x_{min}` .. `x_{max}` 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 [y_1, y_2] 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 (x_i, y_i). 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.

See Also:

plot, plot::copy, plot::PointList2d, plot::Polygon2d, plot::Scatterplot

Details:

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]))

MuPAD graphics

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))

MuPAD graphics

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]]))

MuPAD graphics

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))

MuPAD graphics

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))

MuPAD graphics

Example 3

A random variable describing the number of successes in n Bernoulli trials with success probability p is binomially distributed with expectation value n*p and variance n*p*(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)):

MuPAD graphics

delete n, p:

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS