Plot Piecewise Constant Data

PWC_PLOT is a MATLAB library which plots piecewise constant data.

Suppose you want to plot a piecewise constant function as N bars of varying heights and widths. This is NOT quite a bar plot, and it's not quite a histogram, and MATLAB doesn't seem to make it easy to plot. This library assumes the function is defined as N+1 breakpoints X and N values Y. It converts this data into a string of 2*N+2 or 3*N+1 plot points which, if given to MATLAB's plot() command, will display the corresponding piecewise constant function.


The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.


PWC_PLOT is available in a Matlab version.

Related Data and Programs:

BOX_DISPLAY, a MATLAB program which displays a box plot, over integer pairs of data, of a function defined by two formulas.

BOX_PLOT, a MATLAB program which displays a box plot of data that consists of pairs of integers;

CC_DISPLAY, a MATLAB program which displays the points used in a 2D Clenshaw-Curtis quadrature rule;

CIRCLE_GRID_DISPLAY, a MATLAB program which reads a matrix of integers, and draws a corresponding grid of circles filled with color.

GRF_DISPLAY, a MATLAB program which reads a GRF file defining a mathematical graph and displays it in the MATLAB graphics window.

GRID_DISPLAY, a MATLAB program which reads a file of points on a grid or sparse grid, displays the grid and saves the image in a Portable Network Graphics (PNG) file;

HISTOGRAM_DISPLAY, a MATLAB program which makes a bar plot of a set of data stored as columns in a file; the first column is the X values, and all the other columns are Y values to be shown as a stack of bars;

MOC_DISPLAY, a MATLAB program which estimates and displays the modulus of continuity function for a given function F(X) over a finite interval [A,B], using N sample values.

Source Code:

Examples and Tests:

You can go up one level to the MATLAB source codes.

Last revised on 11 August 2016.