CPlot:GetY CPlot:ToTable

CPlot:SetInfo


The SetInfo method attaches ("tags") a string of data to a plotted point. To view these strings inside the Mira plot window, use the View > Query Point Data menu command to enable query mode and hover over the points.

Syntax

success = CPlot:SetInfo( nIndex, strInfo )

bullet.gif    nIndex is the index of the plot series, from 1 to CPlot:Count.

bullet.gif    strInfo is a string containing the point data.

bullet.gif    success is a boolean value indicating success.

bullet.gif    On failure false is returned.

Example

The following script pulls data from a photometry measurements table and stores the data in rows of a table named GridData. Each row of GridData contains the object name (sObj), airmass (nX), magnitude (nM), magnitude error (nE), and filter name (sF). Then a scatter plot is created from values in GridData. Afterward, the SetInfo method is used to attach a string of selected row data to each of the plotted points:

GridData = {}

-- the master table of grid data

 

-- get data from the grid, one row per grid row

 

 

 

 

 

-- sFilter is the target filter for selecting from the photometry table

 

 

 

 

 

-- now accumulate x, y, and ye (error bar) arrays for plotting

 

 

x = {}

-- table for x axis values

 

y = {}

-- table for y axis values

 

ye = {}

-- table for y error bars

 

-- each index for x, y, and ye is one row from GridData

 

 

for i = 1, nCount do

 

 

  local d = GridData[i]

-- assign a variable to the table row

 

  x[i] = d.nX

-- copy the airmass into x[]

 

  y[i] = d.nM

-- copy the magnitude into y[]

 

  ye[i] = d.nE

-- copy the magnitude error into ye[]

 

end

 

 

 

 

 

-- Create a scatter plot of the photometry data

 

 

-- The CPlotView V and current CPlot (plot series) P are returned

 

 

-- For the y label, concatenate the target filter with " Mag"

 

 

V, P = scattererr(x,y,nil,ye,"X",sFilter .. " Mag")

-- returns the CPlotView and CPlot

 

 

 

 

if not V then Exit("Cannot create a CPlotView") end

-- check that the CPlotView is valid

 

if not P then Exit("Cannot create a CPlot series") end

-- check that the CPlot is valid

 

-- for the current plot series, tag each point with data

 

 

for i = 1, P:Count() do

-- for all plotted points...

 

  local d = GridData[i]

-- assign a variable to the table row

 

  local sPointInfo = Sprintf("%s: X=%lf, %s=%lg\n",

-- create a string of point data

 

                        d.sObj, d.nX, d.sF, d.nM)

 

 

  P:SetInfo(i, sPointInfo)

-- assign the string to the point

 

end

 

 

Related Topics

CPlotView class

CPlot class

GetPt

PlotPoint table

 


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