Skip to content

Plotting

jcanny edited this page May 30, 2014 · 4 revisions

Table of Contents

Basic Plots

BIDMat has basic plotting and histogram capabilities.

To plot a dataset, call "plot(M)" with an argument matrix M, and you get a straight line plot of the value along Y with an implicit X-axis numbered from 1 to numpoints. Plotting two one-dimensional matrices "plot(X,Y)" plots the values as x-y coordinate pairs. You can also plot multiple graphs on the same axes by using alternating X and Y matrices: plot(X1, Y1, X2, Y2,...)

Remote Plotting

On a Linux machine, the plot library uses Xwindows through Java and you need to be running an X server on your machine. It works fine when the machine you are typing at and the machine running BIDMat are distant. When you connect to the remote machine, you need to enable X packet forwarding. If you use ssh from the command line to connect, you should add the "-X" option to cause forwarding to happen.

Customizing Plots

When you call val p = plot(X), it returns a ptolemy.Plot object. You can call any of the methods described in the plolemy docs to customize the plot: http://ptolemy.eecs.berkeley.edu/java/ptplot/

Log and Other Non-Linear Plots

Various log-scale plots are supported, like loglog(), semilogx(), and semilogy().

Histograms

There is a simple histogram function, which you can invoke as

> hist(a)
for any vector a of values. With a single argument, hist automatically choose 20 bins to distribute data values into. You can also control the number of bins with
> hist(a, n)