CPlotView:PlotScatter CPlotView:Remove

CPlotView:PlotStepLine


The PlotStepLine method draws points in a new plot window. The points are drawn as stepped line segments. The line attributes are set in the "View > Default Properties > Image Plots" dialog. The related StepLine method takes its data from x and y tables rather than the CPlotView class data matrix.

Syntax

CPlot = CPlotView:PlotStepLine()

CPlot = CPlotView:PlotStepLine( sX )

CPlot = CPlotView:PlotStepLine( sX, sY )

CPlot = CPlotView:PlotStepLine( sX, sY, sTitle )

CPlot = CPlotView:PlotStepLine( sX, sY, sTitle, sCaption )

bullet.gif    sX is the optional x axis label. If nil, a default is used.

bullet.gif    sY is the optional y axis label. If nil, a default is used.

bullet.gif    sTitle is the optional window title. If nil, a default is used.

bullet.gif    sCaption is the optional plot caption. If nil, a default is used.

Return value:

bullet.gif    CPlot is a new CPlot object attached to the current plot series. It is nil on failure.

Remarks

The plot below shows a step-line plot without error bars. To add error bars, specify them in the call to the CPlotView:Add method. To plot the same data as a line plot, use the CPlotLine method. To plot the same data as a scatterplot with only markers, use the PlotScatter method. To draw both markers and line segments, use the PlotConnected method.

Example

The plot above was created using the script below. The CImageView V was selected from a drop-list of all open image windows, and an image set was chosen. The header keyword AIRMASS was chosen for the x-axis. You could choose any keyword in the headers, or plot against some other value.

 

-- select an image view from open windows

V = attachlist_imageview()

-- Returns a reference V for the CmageView

Assert( V, "No Image views are open")

-- exit if V is nil

 

-- Get the keyword to plot

sKwd = "AIRMASS"

-- default keyword

sKwd, bOK = GetString( sKwd,"Keyword Name:")

 

Assert(bOK)

 

 

-- loop over all images in the CImageView:

nStart = V:GetIndex()

-- save index of top image

for i = 1, V:Count() do

 

 V:SetIndex(i)

-- Change to the i-th image

 I = V:GetImage()

-- get a reference to the image at index i

 if I then

-- if the image is good (it should be!)

  x = i

-- x plot value is the image index.

  y = I:KwdGetNum(sKwd)

-- y plot value is the keyword value

  P:Add(x,y)

-- add the point to the collection

 end

 

end

 

V:SetIndex(nStart)

-- reset the image window to the starting image

 

 

sCap = Sprintf("%s vs Image Index", sKwd )

-- Create caption above the plot for Overplot mode

 

-- plot points with X label, Y label, Title, and Caption

P:PlotStepLine( "Image Index", sKwd, "My Plot", sCap )

-- specify the title and other labels

Related Topics

CPlotView class

PlotConnected

PlotLine

PlotScatter

PlotPoints

 

 


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