Visualization using 2D plotting system

The 2D visual representation of simulation results, usually in the form of a set of graphs, are realized through primitives working as sinks. These primitives generate different types of graphs such as Line plots, Histograms, and so on. All these primitives use the internal plotting system derived from the pxgraph program.

The pxgraph program belongs to the original Ptolemy distribution. These primitives can be found within the Sink library of the according domain, for example, MLD Libraries→SDF Domain→Sinks

These primitives produce the following results:


Generate a generic multi-signal plot.


Generate an XY plot using the 2D plotting system. The X data is on xInput and the Y data is on input.


Generate a multi-trace plot using the 2D plotting system. Successive traces are overlaid on one another.


Generate a histogram using the 2D plotting system. The plot is successive. The parameter binWidth determines the bin width.


Plot a series of traces in the style of a waterfall plot. This is a type of three-dimensional plot used to show the evolution of signals or spectra. Optionally, each plot can be made opaque, so that lines appearing behind the plot are eliminated.


Print out one sample from each input port per line. The fileName parameter specifies the file to be written; the special names stdout and cout specify the standard output stream, as well as stderr and cerr specify the error output stream.

Xgraph configuration

The sink primitives Xgraph, XMgraph and XYgraph are parameterized so you can configure them to display a variety of graph types. They can display up to 64 independent data sets using different colors and/or line styles for each set. It annotates the graph with a title, axis labels, grid lines or tick marks, grid labels, and a legend.

There are options to control the appearance of most components of the graph. Primitives using the pxgraph tool have a options parameter to control the appearance, size, and position of the output graphs. For example, the options

-bg green -tk -P -0 'data out' -1 'data lost' =800x150+0+600

will produce an XMgraph with a bright green background, no grid lines, each data point marked by a pixel sized dot. The first data set is called data out in the legend, and the second data set, data lost. The graph is 800 by 150 pixels in size and is positioned on the left of the screen 600 pixels from the top.

The following statements can be entered in the options field:


Specifies the initial size and location of the plot window. Coordinate values x and y are optional. (+0+0 indicates the top left corner of the screen).

-<digit> <name>

The legend title for the corresponding data set. The digit can range between 0 and 63 with -0 being the first data set and -1 being the second. The name will be seen in the legend.


Removes the light gray grid pattern from the graph background.


Specifies that vertical bars should be drawn from the data points to a base point, which can be specified with -brb. Usually, the -nl flag is used with this option. The point itself is located at the center of the bar.


In previous versions this was used to draw a bounding box around the data region. This option is not supported anymore. All graphs have bounding boxes.

-bg <color>

Background color of the plot window. Color may be given in one of these formats:

  • #RGB (each of R, G, and B is a single hex digit)
  • A name from the list of colors defined in the list of SVG color keyword names provided by the World Wide Web Consortium; for example, steelblue or gainsboro. These color names work on all platforms.


This specifies that the input is a binary file rather than an ASCII file.

-brw <width>

This specifies the width of bars in a bar graph. The amount is specified in the user's units. By default, a bar is drawn with one pixel width.

-fg <color>

Foreground color. This color is used to draw all the text and the normal grid lines in the window. See -bg on how to format the color.

-lf <fontname>

Label font. All axis labels and grid labels are drawn using this font. A font name may be specified in the form: <family>-<[weight|italic]>-<[italic|weight]>-<[size]>. Where family is the family name (for example, Helvetica), weight is BOLD or *, italic is ITALIC or * and the size is the font size in points (for example, 12). The default value for this parameter is Helvetica-12.


Specifies a logarithmic x axis. Grid labels represent powers of ten.


Specifies a logarithmic y axis. Grid labels represent powers of ten.

-lx <xl,xh>

This option limits the range of the x axis to the specified interval. This (along with -ly) can be used to "zoom in" to a particularly interesting portion of a larger graph.

-ly <yl,yh>

This option limits the range of the y axis to the specified interval.


Mark each data point with a distinctive marker. There are eight distinctive markers used by the plotting system. These markers are assigned uniquely to each different line styles on black and white machines and varies with each color on color machines.


Similar to -m but markers are assigned uniquely to each of the eight consecutive data sets (this corresponds to each different line style on color machines).


Turn off drawing lines. When used with -m, -M, -p, or -P this can be used to produce scatter plots. When used with -bar, it can be used to produce standard bar graphs.


Marks each data point with a small marker (pixel sized). This is usually needed with the -nl option for scatter plots.


Similar to -p but marks each pixel with a large dot.

-t <string>

Title of the plot. This string is centered at the top of the graph.

-tf <fontname>

Title font. This is the name of the font to use for the graph title. The usage is the same as for the -lf option.


Redundant option. Replaced by the Parameter 'Cumulation'.

-x <unitname>

This is the unit name for the X axis. Its default is "X".

-y <unitname>

This is the unit name for the Y axis. Its default is "Y".