CPlotView:Class Description


The CPlotView class displays 1-dimensional data as a plot. The CPlotView class leverages the richness and power of the Mira Plot Window and also can operate on existing Plot windows you attach to the script. Point data can be plotted from the following sources:

    An internal collection (matrix) of data points filled using the Add method. This protocol is the most general, providing any combination of moves, markers, and lines, with or without error bars.

    Equally spaced data stored in the rows of a CMatrix. These data can be plotted as a line plot or using symbols. The step values on the x axis are unit values, so this protocol is useful for plotting line graphs of image data.

    The rows and columns of a CImage.

    The rows and columns of a displayed image as outlined by the image cursor in a CImageView.

Related Global Functions

The following functions are provided to expedite plotting of data when the values to be plotted are in arrays. The functions also can plot x and y error bars. They return an instance of a CPlotView object to the script for additional use. These functions are compared here.

Plot

Creates a scatter plot using markers.

PlotLine

Creates a line plot that connects all points.

PlotStep

Creates a plot plot showing a stepped line between points.

PlotConnect

Create a hybrid plot with markers and lines connecting the markers.

Usage

Construction

Object = CPlotView:new()

Destruction

Object:delete()

CPlotView Topics

Plotting a Least Squares Fit

Methods

Construction

new

Creates a new instance of a CPlotView object.

delete

Deletes the CPlotView object.

Attach

Attaches the top-most window (a Plot window) to the script and creates a new CPlotView object for it.

GetViewPtr

Retrieves the pointer to the Mira plot window attached to this CPlotView instance.

AttachHandle

Attaches the handle of a plot window to this CPlotView object.

GetHandle

Retrieves the handle of the GUI plot window attached to the current object.

Working with Data Points

These methods work with the internal data array that holds points for plotting.

Add

Adds an x,y pair and, optionally, error bars to the data array using the specified drawing mode (move, marker, line).

MoveTo

Moves to the point x,y without drawing a marker, line, or error bars.

LineTo

Draws a line from the last point to the specified x,y point. Error bars also can be specified for x,y.

Marker

Draws a marker at the specified x,y point. Error bars also can be specified for x,y.

LineToMarker

Draws a line from the previous point to the specified x,y point and draws a marker. Error bars also can be specified for x,y.

 

Count

Returns the number of points in the data array.

Empty

Empties all point data from the data array.

FindPoint

Returns the index of the point in the data array nearest an x,y.

GetPtX

Returns the x value of a point.

GetPtObs

Returns the y value of a point.

GetPtErrX

Returns the x errorbar value of a point.

GetPtErrY

Returns the y errorbar value of a point.

Remove

Deletes a point from the data array.

Data Plotting

These methods plot the class data matrix into a new window, append to an existing plot, or plot it as a new series in an existing window.

PlotPoints

Creates a plot from points Added to the the data array.

AddPoints

Adds the current series in an existing plot window into the class data matrix.

AddSeries

Adds the class data matrix to an existing plot window as a new plot series.

Matrix Plotting

These methods work with an external CMatrix as the data source for plotting. Each row of the matrix defines a different plot series. Within a row, each (column,value) pair defines an (x,y) value to be plotted. Note that the x value (or "column" is integral; to plot arbitrary x,y points, use Add, PlotPoints, and AddSeries.

AddMatrixRange

Appends a range or matrix rows to an existing plot as symbols.

AddMatrixRangeLine

Appends a range of matrix rows to an existing plot as lines.

PlotMatrix

Creates a scatter plot of all rows in a matrix.

PlotMatrixLine

Creates a line plot of all rows in a matrix.

PlotMatrixRange

Creates a multi-series scatter plot from a range of rows in a matrix.

PlotMatrixRangeLine

Creates a multi-series line plot from a range of rows in a matrix.

Image Plotting

These commands create plot data from the columns or rows of images and displayed images.

PlotImageCol

Plots a column from a CImage.

PlotImageRow

Plots a row from a CImage.

PlotCursorCol

Plots the column at the center of the image cursor for images displayed in a CImageView.

PlotCursorColAvg

Plots the averaged column inside the image cursor for images displayed in a CImageView.

PlotCursorColRange

Plots all columns inside the image cursor for images displayed in a CImageView.

PlotCursorRow

Plots the row at the center of the image cursor for images displayed in a CImageView.

PlotCursorRowAvg

Plots the averaged row inside the image cursor for images displayed in a CImageView.

PlotCursorRowRange

Plots all rows inside the image cursor for images displayed in a CImageView.

Working with Plot Series

These methods work with the plot series of the plot window.

CountSeries

Returns the number of plot series.

CountSeriesPoints

Returns the number of plotted points in a plot series.

GetIndex

Returns the index of the current series.

SetIndex

Sets the index of the current series.

SetCaption

Sets a caption for the plot series.

GetCaption

Retrieves the caption for a plot series.

SetDescription

Sets a description for a plot series.

GetDescription

Rereieves the description from a plot series.

SetSeriesMode

Sets the plot series mode (over-plot, etc.) for the plot window.

GetSeriesMode

Retrieves the plot series mode used by the plot window.

Plot Legends

The plot legend shows a caption for each series.

SetLegendStyle

Sets the legend style, including showing no legend.

GetlegendStyle

Returns the legend style.

SetLegendColor

 

GetLegendColor

 

SetLegendBoxEnable

 

GetLegendBoxEnable

 

SetLegendBoxColor

 

GetLegendBoxColor

 

SetLegendText

 

GetLegendText

 

SetLegendEnable

 

GetLegendEnable

 

Plot Display

These methods change the way the plot is displayed in the window.

 

SetWindowTitle

 

SetLabelX

 

SetAutoscaleX

 

SetPosX

 

SetMinX

 

SetMaxX

 

SetLabelY

 

SetAutoscaleY

 

SetPosY

 

SetMinY

 

SetMaxY

 

Related Topics

Global Plotting Functions

CPlotView class

CImage class

CRect class

CMatrix class

CImageView class