CPlot Class Description


The CPlot class provides access to the points in a plot series for a CPlotView window. For example, if a column plot contains a column from each of 4 images, and this plot window is attached to a CPlotView object, then the CPlot class can be used to access the points in each of the 4 plot series. A CPlot class object may be created as "new" but is usually returned by a CPlotView function or by one of the non-class ploting functions.

See the sample script CPlot class test.lua in the <Documents>/Mira Pro x64 Data/Scripts/Samples folder.

Executing Scripts from Plot Windows

The Execute Script menu command may be used to open and execute a script directly from a Mira Plot Window, prociding access to its plot series. When a script is executed from the Execute Script command, it is automatically sent a CPlotView object named ParentPlotView and a CPlot object named ParentPlot. The ParentPlotView is a CPlotView object that provides access to the window's plot series and other class members. The ParentPlot is a CPlot object attached to the current image in the Plot Window. You can use these names directly in the script or you can rename them, like V = ParentPlotView and P = ParentPlot. A sample script call to be called from a Plot Window is provided named Execute from Plot Window test.lua.

Usage

Creation

Object = new_plot()

Object = CPlot:new()

Object = CPlotView:GetPlot()

Object = CPlotView:GetPlot( nIndex )

Creation - Non-class Functions

This function is normally used to create and attach a new CPlot object as an alternative to the class-based new method. A new CPlot object is also returned by the GetPlot method of the CPlotView class.

new_plot

Creates a new instance of the CPlot class.

Construction and Destruction - Class Methods

new

Creates a new instance of a CPlot object.

delete

Deletes the CPlot object.

Plot Point Properties

The data for each plotted point accessed through CPlot object is contained in a named-keyed table, named the PlotPoint table. These are accessible using the ToTable method and GetPt method.

Methods

These methods work with an plot data that holds points for plotting. The array holds the x,y coordinates and optional errorbars.

Count

Returns the number of points in the plot series.

FindNearestX

Returns the index in a plot series of the point with x value nearest a target value.

FindNearestY

Returns the index in a plot series of the point with y value nearest a target value.

GetPt

Returns the PlotPoint table for the point at an index in the plot series.

GetX

Returns the x value of the point at an index in a plot series.

GetY

Returns the y value of the point at an index in a plot series.

GetXY

Returns the x and y values of the point at an index in a plot series.

ToTable

Creates a table containing the PlotPoint data for each point in the plot series.

Related Topics

Script Classes, CPlotView class, Plotting Functions, CPlotView:GetPlot()

 


Mira Pro x64 Script User's Guide, Copyright Ⓒ 2023 Mirametrics, Inc. All Rights Reserved.