## org.autoplot.ScriptContext2023

ScriptContext provides the API to perform abstract functions with the application. For example,

>     {@code
>      ScriptContext.load('https://autoplot.org/data/somedata.dat')
>      ScriptContext.writeToPdf('/tmp/foo.pdf')
>     }

## PNG_KEY_SCRIPT

The name of the script which results in the image, optionally with its arguments.

## PNG_KEY_VAP

The Autoplot .vap file which results in the image, optionally with "?" and modifiers.

## PNG_KEY_URI

The Autoplot URI which results in the image.

## _setOutputStream

_setOutputStream( java.io.OutputStream out ) → void

resets the output stream. This method is used internally, do not use this routine.

### Parameters

out - an OutputStream

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## addBottomDecoration

addBottomDecoration( org.autoplot.dom.DomNode node, org.python.core.PyFunction painter ) → void

add code that will paint custom graphics on the canvas or on a plot. The command will be invoked after all other painting is done, making the decoration to be on top. Note plots can only have one decoration, and the Canvas can have any number. Calling reset() will remove all decorations.

>     def paint(g):
>         g.color= Color.BLUE
>         for i in xrange(0,1000,100):
>             g.drawOval(500-i/2,500-i/2,i,i)

>     addBottomDecoration( dom.canvases[0], paint )

### Parameters

node - the plot or canvas over which to plot
painter - the PyFunction to call when painting

### Returns:

void (returns nothing)

### See Also:

https://github.com/autoplot/dev/blob/master/demos/2020/20200229/demoAddBottomDecoration.jy
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## addMouseModule

addMouseModule( org.autoplot.dom.Plot plot, String label, org.python.core.PyFunction listener ) → org.das2.event.MouseModule

add code that will respond to mouse events. This will receive an event following the mouse release when a box is dragged out.

>     def boxLookup( evt ):
>         showMessageDialog( "start: (%s,%s)
>     finish: (%s,%s)" %
>             ( evt.getStartX(), evt.getStartY(),
>             evt.getFinishX(), evt.getFinishY() ) )

>     addMouseModule( dom.plots[0], 'Box Lookup', boxLookup )

### Parameters

plot - the plot which will receive the events.
label - a label for the mouse module.
listener - the PyFunction to call with new events.

### Returns:

the mouse module.

### See Also:

org.das2.event.MouseModule#setDragRenderer(org.das2.event.DragRenderer) setDragRenderer to see how to set how feedback can be provided.
org.das2.event.BoxSelectionEvent BoxSelectionEvent for the methods of the event.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## addPlotElement

addPlotElement( int chNum ) → int

"overplot" by adding another PlotElement to the plot and setting the data to this PlotElement.

### Parameters

chNum - the focus

### Returns:

the channel number for the new plot element.

### See Also:

setLayout(int, int)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## addPlots

addPlots( int nrows, int ncolumns, String dir ) → java.util.List

adds a block of plots to the canvas below the focus plot. A plotElement is added for each plot as well.

### Parameters

nrows - number of rows
ncolumns - number of columns
dir - below, above, right, or left, or null (None in Jython) to replace the current plot.

### Returns:

the new plots.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## addTab

addTab( String label, javax.swing.JComponent c ) → void

add a tab to the running application. A new tab will be added with the label, with the component added within a scroll pane.

### Parameters

label - the label for the component.
c - the component to add.

### Returns:

void (returns nothing)

### See Also:

AutoplotUI#setLeftPanel(javax.swing.JComponent) setLeftPanel which adds to the GUI
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## addTopDecoration

addTopDecoration( org.autoplot.dom.DomNode node, org.python.core.PyFunction painter ) → void

add code that will paint custom graphics on the canvas or on a plot. The command will be invoked after all other painting is done, making the decoration to be on top. Note plots can only have one decoration, and the Canvas can have any number. Calling reset() will remove all decorations.

>     def paint(g):
>         for i in xrange(0,1000,100):
>             g.drawOval(500-i/2,500-i/2,i,i)

>     addTopDecoration( dom.canvases[0], paint )

### Parameters

node - the plot or canvas over which to plot
painter - the PyFunction to call when painting

### Returns:

void (returns nothing)

### See Also:

https://github.com/autoplot/dev/blob/master/demos/2020/20200229/demoAddBottomDecoration.jy
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## alert

alert( String message ) → void

show a popup that you know the user will see. Note HTML code will work.

### Parameters

message - a String

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## bind

bind( Object src, String srcProp, Object dst, String dstProp ) → void

binds two bean properties together. Bindings are bidirectional, but the initial copy is from src to dst. In MVC terms, src should be the model and dst should be a view. The properties must fire property change events for the binding mechanism to work. As of v2014a_10, if the src is a DomNode and a child of the application, then use dom.getController().bind so that the vap will contain the binding. Example:

>      model= getApplicationModel()
>      bind( model.getPlotDefaults(), "title", model.getPlotDefaults().getXAxis(), "label" )

### Parameters

src - java bean such as model.getPlotDefaults()
srcProp - a property name such as "title"
dst - java bean such as model.getPlotDefaults().getXAxis()
dstProp - a property name such as "label"

### Returns:

void (returns nothing)

### See Also:

org.autoplot.dom.ApplicationController#bind(org.autoplot.dom.DomNode, java.lang.String, java.lang.Object, java.lang.String) which will save the binding to a vap.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## bind

bind( Object src, String srcProp, Object dst, String dstProp, Converter c ) → void

binds two bean properties together. Bindings are bidirectional, but the initial copy is from src to dst. In MVC terms, src should be the model and dst should be a view. The properties must fire property change events for the binding mechanism to work. As of v2014a_10, if the src is a DomNode and a child of the application, then use dom.getController().bind so that the vap will contain the binding. Example:

>      model= getApplicationModel()
>      bind( model.getPlotDefaults(), "title", model.getPlotDefaults().getXAxis(), "label" )

### Parameters

src - java bean such as model.getPlotDefaults()
srcProp - a property name such as "title"
dst - java bean such as model.getPlotDefaults().getXAxis()
dstProp - a property name such as "label"
c - converter for the binding, or null.

### Returns:

void (returns nothing)

### See Also:

org.autoplot.dom.ApplicationController#bind(org.autoplot.dom.DomNode, java.lang.String, java.lang.Object, java.lang.String, org.jdesktop.beansbinding.Converter) which will save the binding to a vap.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## bindGuiSafe

bindGuiSafe( Object src, String srcProp, Object dst, String dstProp, Converter c ) → void

binds two bean properties together. Bindings are bidirectional, but the initial copy is from src to dst. In MVC terms, src should be the model and dst should be a view. The properties must fire property change events for the binding mechanism to work. As of v2014a_10, if the src is a DomNode and a child of the application, then use dom.getController().bind so that the vap will contain the binding. Example:

>      model= getApplicationModel()
>      bind( model.getPlotDefaults(), "title", model.getPlotDefaults().getXAxis(), "label" )

### Parameters

src - java bean such as model.getPlotDefaults()
srcProp - a property name such as "title"
dst - java bean such as model.getPlotDefaults().getXAxis()
dstProp - a property name such as "label"
c - converter for the binding, or null.

### Returns:

void (returns nothing)

### See Also:

org.autoplot.dom.ApplicationController#bind(org.autoplot.dom.DomNode, java.lang.String, java.lang.Object, java.lang.String, org.jdesktop.beansbinding.Converter) which will save the binding to a vap.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## createApplicationModel

createApplicationModel( String id ) → org.autoplot.ApplicationModel

return a new dom in a minimal Autoplot application. Use result.getCanvas() to get the DasCanvas which can be added to other components.

>     report= createApplicationModel()
>     addTab( 'report', report.canvas )
>     report.setDataSet(linspace(0,1,101))

### Parameters

id - a String

### Returns:

an org.autoplot.ApplicationModel
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## createDataPointRecorder

createDataPointRecorder( ) → org.das2.components.DataPointRecorder

return a component which can be used to accumulate data. This is typically inserted into its own tab with the addTab command. This is set to sort data in X as it comes in, and this can be disabled with setSorted(False)

>     dpr= createDataPointRecorder()
>     addTab( 'digitizer', dpr )

### Returns:

a new DataPointRecorder.

### See Also:

DataPointRecorder
https://github.com/autoplot/dev/blob/master/demos/digitizers/createDataPointRecorder.jy
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## createGui

createGui( ) → void

create a model with a GUI presentation layer. If the GUI is already created, then this does nothing.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## dumpToDas2Stream

dumpToDas2Stream( QDataSet ds, boolean ascii ) → void

serializes the dataset to a das2stream, a well-documented, open, streaming data format. (that's a joke.) Das2Streams are the legacy stream format used by the Plasma Wave Groups's server, and can serialize a limited set of QDataSets. QStreams were introduced to allow streaming of any QDataSet, see dumpToQStream. Currently, to keep the channel open, the stream is created in a buffer and then the buffer is sent. TODO: write a stream-producing code that doesn't close the output stream. (TODO: does it still do this?)

### Parameters

ds - a QDataSet
ascii - use ascii transfer types, otherwise binary are used.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## dumpToDas2Stream

dumpToDas2Stream( QDataSet ds, String file, boolean ascii ) → void

serializes the dataset to a das2stream, a well-documented, open, streaming data format. (that's a joke.) Currently, to keep the channel open, the stream is created in a buffer and then the buffer is sent. TODO: write a stream-producing code that doesn't close the output stream.

### Parameters

ds - a QDataSet
file - the file target for the stream.
ascii - use ascii transfer types.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## dumpToQStream

dumpToQStream( QDataSet ds, java.io.OutputStream out, boolean ascii ) → void

serializes the dataset to a QStream, a self-documenting, streaming format useful for moving datasets.

>     ds= getDataSet('http://autoplot.org/data/somedata.cdf?BGSEc')
>     from java.lang import System
>     dumpToQStream( ds, System.out, True )

### Parameters

ds - The dataset to stream. Note all schemes should be streamable, but some bugs exist that may prevent this.
out - stream, such as "System.out"
ascii - use ascii transfer types, otherwise binary are used.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## fixLayout

fixLayout( ) → void

make the layout more efficient by removing empty spaces and overlapping plots.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## formatDataSet

formatDataSet( QDataSet ds, String file ) → void

Export the data into a format implied by the filename extension. See the export data dialog for additional parameters available for formatting. For example:

>      ds= getDataSet('http://autoplot.org/data/somedata.cdf?BGSEc')
>      formatDataSet( ds, 'vap+dat:file:/home/jbf/temp/foo.dat?tformat=minutes&format=6.2f')

### Parameters

ds - a QDataSet
file - local file name that is the target

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## formatDataSet

formatDataSet( QDataSet ds, String file, ProgressMonitor monitor ) → void

Export the data into a format implied by the filename extension. See the export data dialog for additional parameters available for formatting. For example:

>      ds= getDataSet('http://autoplot.org/data/somedata.cdf?BGSEc')
>      formatDataSet( ds, 'vap+dat:file:/home/jbf/temp/foo.dat?tformat=minutes&format=6.2f')
>      formatDataSet( ds, 'foo.dat' ) # also okay

### Parameters

ds - a QDataSet
file - local file name that is the target.
monitor - a ProgressMonitor

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## generateTimeRanges

generateTimeRanges( String spec, String srange ) → String[]

Given a spec to format timeranges and a range to contain each timerange, produce a list of all timeranges covering the range formatted with the spec. For example, `generateTimeRanges( "%Y-%m-%d", "Jun 2009" )` would result in 2009-06-01, 2009-06-02, ..., 2009-06-30.

### Parameters

spec - such as "%Y-%m". Note specs like "%Y%m" will not be parsable.
srange - range limiting the list, such as "2009"

### Returns:

a string array of formatted time ranges, such as [ "2009-01", "2009-02", ..., "2009-12" ]
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getApplication

getApplication( ) → org.autoplot.AutoplotUI

return the focus application.

### Returns:

the focus application.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getApplicationModel

getApplicationModel( ) → org.autoplot.ApplicationModel

returns the internal application model (the object that does all the business). This provides access to the internal model for power users. Note the applicationModel provides limited access, and the DOM now provides full access to the application.

### Returns:

ApplicationModel object
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getCompletions

getCompletions( String file ) → String[]

return a list of completions. This is useful in the IDL context as well as Jython scripts. This will perform the completion for where the carot is at the end of the string. Only completions where maybePlot indicates the URI is now valid are returned, so for example https://autoplot.org/data/somedata.cdf?noDep is not returned and https://autoplot.org/data/somedata.cdf?Magnitude is. Note this is included to continue support as this is described in https://autoplot.org/developer.idlMatlab.

### Parameters

file - a String

### Returns:

list of completions, containing the entire URI.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getDocumentModel

getDocumentModel( ) → org.autoplot.dom.Application

get the document model (DOM). This may initialize the model, in which case defaults like the cache directory are set.

### Returns:

an org.autoplot.dom.Application
[search for examples] [view on GitHub] [view on old javadoc] [view source]
getInstance( ) → org.autoplot.ScriptContext2023 [view source]

## getTimeRangesFor

getTimeRangesFor( String surl, String timeRange, String format ) → String[]

return an array of URLs that match the spec for the time range provided. For example,

>       uri= 'http://cdaweb.gsfc.nasa.gov/istp_public/data/polar/hyd_h0/$Y/po_h0_hyd_$Y$m$d_v01.cdf?ELECTRON_DIFFERENTIAL_ENERGY_FLUX'
>       xx= getTimeRangesFor( uri, '2000-jan', '$Y-$d-$m' )
>       for x in xx:
>         print x

### Parameters

surl - an Autoplot uri with an aggregation specifier.
timeRange - a string that is parsed to a time range, such as "2001"
format - format for the result, such as "%Y-%m-%d"

### Returns:

a list of URLs without the aggregation specifier.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getViewWindow

getViewWindow( ) → java.awt.Window

return the Window for the application, to be used for dialogs. See createGui(), which creates the view.

### Returns:

a java.awt.Window
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getWindow

getWindow( ) → org.autoplot.ApplicationModel

return the internal handle for the window and dom within.

### Returns:

the internal handle for the application.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## isModelInitialized

isModelInitialized( ) → boolean

provide way to see if the model is already initialized (e.g. for clone application)

### Returns:

true is the model is already initialized.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## load

load( String filename ) → void

load the .vap file. This is implemented by calling plot on the URI.

### Parameters

filename - local or remote filename like http://autoplot.org/data/autoplot.vap

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## loadVap

loadVap( String filename ) → org.autoplot.dom.Application

load a vap from a file and return the dom.

### Parameters

filename - .vap file

### Returns:

Application

### See Also:

saveVap(org.autoplot.dom.Application, java.lang.String)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## makeColorTable

makeColorTable( String name, QDataSet index, QDataSet rgb ) → org.das2.graph.DasColorBar.Type

returns a color table with the given name. If the name is already registered, then the registered colortable is returned. using QDataSets as inputs to make it easier to use in scripts.

### Parameters

name - the name for the colortable.
index - control points for the colors, or None
rgb - dataset of ds[N,3] where N is the number of colors

### Returns:

object representing the color table.

### See Also:

rgbColorDataset
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## mkdir

mkdir( String dir ) → void

make the directory. This must be a local file right now, but may start with "file://"

### Parameters

dir - the directory

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## newApplication

newApplication( String id ) → org.autoplot.AutoplotUI

get or create the application identified by the name. For example:

>     ds= ripples(20,20)
>     plot( 0, ds )
>     sliceWindow= newApplication('slice')
>     setApplication(sliceWindow)
>     plot( slice0(ds,0) )

Windows with this name will be reused.

### Parameters

id - an identifier

### Returns:

the AutoplotUI.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## newDialogWindow

newDialogWindow( java.awt.Window parent, String title ) → org.autoplot.ApplicationModel

return a new Autoplot.

### Parameters

parent - a Window
title - a String

### Returns:

an org.autoplot.ApplicationModel
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## newWindow

newWindow( String id, int width, int height, int x, int y ) → org.autoplot.ApplicationModel

create a new window with the given location and size.

### Parameters

id - identifier for the window
width - the canvas width
height - the canvas height
x - the window upper-left location, if possible
y - the window upper-left location, if possible

### Returns:

a handle (do not use this object, code will break) for the window.

### See Also:

setWindow(org.autoplot.ApplicationModel)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## newWindow

newWindow( String id ) → org.autoplot.ApplicationModel

create a new window.

### Parameters

id - identifier for the window

### Returns:

a handle (do not use this object, code will break) for the window.

### See Also:

setWindow(org.autoplot.ApplicationModel)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## peekAt

peekAt( Object o ) → void

This is intended to be used with a debugger. The developer should put a breakpoint at the out.write statement, and then call peekAt from the script.

### Parameters

o - any object we want to look at.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## plot

plot( String suri ) → void

bring up the autoplot with the specified URL. Note the URI is resolved asynchronously, so errors thrown during the load cannot be caught here. See getDataSet to load data synchronously.

### Parameters

suri - a URI or vap file

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## plot

plot( String surl1, String surl2 ) → void

plot one URI against another. No synchronization is done, so beware. Introduced for testing non-time axis TSBs.

### Parameters

surl1 - the independent variable dataset (generally used for X)
surl2 - the dependent variable dataset (generally used for Y, but can be rank 2).

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## plot

plot( int chNum, String surl ) → void

bring up the autoplot with the specified URL.

### Parameters

chNum - the data source number to reset the URI.
surl - a URI to use

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## plot

plot( int chNum, String label, String surl ) → void

bring up the plot with the specified URI.

### Parameters

chNum - the data source number to reset the URI.
label - for the plot.
surl - a URI to use

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## plot

plot( QDataSet ds ) → void

plot the dataset in the first dataSource node.

### Parameters

ds - QDataSet to plot

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## plot

plot( QDataSet x, QDataSet y ) → void

plot the dataset in the first dataSource node.

### Parameters

x - QDataSet for the independent parameter
y - QDataSet for the dependent parameter

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## plot

plot( QDataSet x, QDataSet y, QDataSet z ) → void

plot the dataset in the first dataSource node.

### Parameters

x - QDataSet for the independent parameter for the X values
y - QDataSet for the independent parameter for the Y values
z - Rank 1 or Rank 2 QDataSet for the dependent parameter

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## plot

plot( int chNum, QDataSet ds ) → void

plot the dataset in the specified dataSource node.

### Parameters

chNum - the plot to use. Plots and plot elements are added as necessary to plot the data.
ds - dataset to plot.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## plot

plot( int chNum, QDataSet x, QDataSet y ) → void

plot the dataset in the specified dataSource node.

### Parameters

chNum - the plot to use. Plots and plot elements are added as necessary to plot the data.
x - QDataSet for the independent parameter for the X values
y - QDataSet for the independent parameter for the Y values

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## plot

plot( int chNum, QDataSet x, QDataSet y, QDataSet z ) → void

plot the dataset in the specified dataSource node.

### Parameters

chNum - the plot to use. Plots and plot elements are added as necessary to plot the data.
x - QDataSet for the independent parameter for the X values
y - QDataSet for the independent parameter for the Y values
z - Rank 1 or Rank 2 QDataSet for the dependent parameter

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## plot

plot( int chNum, String label, QDataSet ds ) → void

bring up the autoplot with the dataset

### Parameters

chNum - the plot to use. Plots and plot elements are added as necessary to plot the data.
label - the label for the plot dependent parameter
ds - the dataset to use.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## plot

plot( int chNum, String label, QDataSet x, QDataSet y ) → void

plot the dataset in the specified dataSource node.

### Parameters

chNum - the plot to use. Plots and plot elements are added as necessary to plot the data.
label - the label for the plot dependent parameter
x - QDataSet for the independent parameter for the X values
y - QDataSet for the independent parameter for the Y values

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## plot

plot( int chNum, String label, QDataSet x, QDataSet y, String renderType ) → void

plot the dataset in the specified dataSource node. Note this should not be called from the event thread.

### Parameters

chNum - the plot to use. Plots and plot elements are added as necessary to plot the data.
label - the label for the plot dependent parameter
x - QDataSet for the independent parameter for the X values, or null.
y - QDataSet for the independent parameter for the Y values, or null.
renderType - string explicitly controlling the renderType and hints.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## plot

plot( int chNum, String label, QDataSet x, QDataSet y, String renderType, boolean reset ) → void

plot the dataset in the specified dataSource node. Note this should not be called from the event thread.

### Parameters

chNum - the plot to use. Plots and plot elements are added as necessary to plot the data.
label - the label for the plot dependent parameter
x - QDataSet for the independent parameter for the X values, or null.
y - QDataSet for the independent parameter for the Y values, or null.
renderType - string explicitly controlling the renderType and hints.
reset - reset by autoranging, autolabelling, etc.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## plot

plot( int chNum, String label, QDataSet x, QDataSet y, QDataSet z ) → void

plot the dataset in the specified dataSource node.

### Parameters

chNum - the plot to use. Plots and plot elements are added as necessary to plot the data.
label - the label for the plot dependent parameter
x - QDataSet for the independent parameter for the X values
y - QDataSet for the independent parameter for the Y values
z - Rank 1 or Rank 2 QDataSet for the dependent parameter

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## plot

plot( int chNum, String label, QDataSet x, QDataSet y, QDataSet z, String renderType ) → void

plot the dataset in the specified dataSource node, using the render type specified. The renderType parameter is a string identifier, and currently the following are used: digital spectrogram nnSpectrogram hugeScatter series scatter colorScatter stairSteps fillToZero digital image pitchAngleDistribution eventsBar vectorPlot orbitPlot contour

>     plot( 0, 'label', findgen(20), ripples(20), ripples(20), 'digital' )
>     from org.autoplot import RenderType
>     plot( 0, 'label', findgen(20), ripples(20), ripples(20), RenderType.digital.toString() )

### Parameters

chNum - the plot to use. Plots and plot elements are added as necessary to plot the data.
label - the label for the dependent parameter
x - QDataSet for the independent parameter for the X values
y - QDataSet for the independent parameter for the Y values
z - Rank 1 or Rank 2 QDataSet for the dependent parameter, or null.
renderType - hint at the render type to use, such as "nnSpectrogram" or "digital",

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## plot

plot( int chNum, String label, QDataSet x, QDataSet y, QDataSet z, String renderType, boolean reset ) → void

plot the dataset in the specified dataSource node, using the render type specified. The renderType parameter is a string identifier, and currently the following are used: digital spectrogram nnSpectrogram hugeScatter series scatter colorScatter stairSteps fillToZero digital image pitchAngleDistribution eventsBar vectorPlot orbitPlot contour

>     plot( 0, 'label', findgen(20), ripples(20), ripples(20), 'digital' )
>     from org.autoplot import RenderType
>     plot( 0, 'label', findgen(20), ripples(20), ripples(20), RenderType.digital.toString() )

### Parameters

chNum - the plot to use. Plots and plot elements are added as necessary to plot the data.
label - the label for the dependent parameter
x - QDataSet for the independent parameter for the X values
y - QDataSet for the independent parameter for the Y values
z - Rank 1 or Rank 2 QDataSet for the dependent parameter, or null.
renderType - hint at the render type to use, such as "nnSpectrogram" or "digital",
reset - reset by autoranging, autolabelling, etc.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## reset

reset( ) → void

reset the application to its initial state.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## save

save( String filename ) → void

save the current state as a vap file

### Parameters

filename - a String

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## saveVap

saveVap( org.autoplot.dom.Application dom, String filename ) → void

save the application dom to a file.

### Parameters

dom - the application state
filename - the file.

### Returns:

void (returns nothing)

### See Also:

loadVap(java.lang.String)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setApplication

setApplication( org.autoplot.AutoplotUI app ) → void

set the current application for commands. For example, to have two windows plotting data, you would:

     plot([1,2,3])
     popup=newWindow('popup')
     setWindow(popup)
     plot([3,2,1])

### Parameters

app - the application

### Returns:

void (returns nothing)

### See Also:

setWindow(org.autoplot.ApplicationModel)
newApplication(java.lang.String)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setApplicationModel

setApplicationModel( org.autoplot.ApplicationModel m ) → void

set the focus for scripts.

### Parameters

m - the application model.

### Returns:

void (returns nothing)

### See Also:

setWindow,
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setCanvasSize

setCanvasSize( int width, int height ) → void

set the size of the canvas. This is only used when the GUI is not used, and in headless mode, otherwise the GUI controls the size of the canvas.

### Parameters

width - the width of the canvas
height - the height of the canvas

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setDataSourceURL

setDataSourceURL( String surl ) → void

set the internal model's url to surl. The data set will be loaded, and writeToPng and writeToSvg can be used in headless mode.

### Parameters

surl - a String

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setDefaultApplication

setDefaultApplication( ) → void

reset the script focus to the default application.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setLayout

setLayout( int nrows ) → void

make a stack plot.

### Parameters

nrows - number of rows (plots)

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setLayout

setLayout( int nrows, int ncolumns ) → void

reset the layout to have the given number of rows and columns. This is similar to the subplot command in Matlab and !p.multi in IDL. Once additional plots are added, use the plot command with the index argument.

### Parameters

nrows - number of rows
ncolumns - number of columns

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setLayoutOverplot

setLayoutOverplot( int nplotElement ) → void

make a single plot with so many plot elements.

### Parameters

nplotElement - the number of plotElements on the one plot.

### Returns:

void (returns nothing)

### See Also:

setLayout(int, int) setLayout(int, int) which will create a grid of plots.
addPlotElement(int) addPlotElement(int) which will an another plotElement (an overplot) to the ith position.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setRenderStyle

setRenderStyle( String name ) → void

Set the style used to render the data using a string identifier: spectrogram, series, scatter, histogram, fill_to_zero, digital

### Parameters

name - string name of the plot style.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setStatus

setStatus( String message ) → void

set the Autoplot status bar string. Use the prefixes "busy:", "warning:" and "error:" to set icons.

### Parameters

message - a String

### Returns:

void (returns nothing)

### See Also:

showMessageDialog(java.lang.String)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setTitle

setTitle( String title ) → void

set the title of the plot.

### Parameters

title - a String

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setWindow

setWindow( org.autoplot.ApplicationModel appm ) → void

Set the application model. This is the simplest Autoplot implementation existing, where there are no buttons, etc.

### Parameters

appm - an ApplicationModel

### Returns:

void (returns nothing)

### See Also:

newWindow(java.lang.String)
getWindow() which returns the current window.
setApplication(org.autoplot.AutoplotUI) which creates another application.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setWindowLocation

setWindowLocation( int x, int y ) → void

set the window location

### Parameters

x - the window upper-left location, if possible
y - the window upper-left location, if possible

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## showMessageDialog

showMessageDialog( String message ) → void

show a popup to the scientist, which they must acknowledge before this returns.

### Parameters

message - a String

### Returns:

void (returns nothing)

### See Also:

setStatus(java.lang.String)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## sleep

sleep( int millis ) → void

sleep for so many milliseconds. This is introduced to avoid the import, which makes running scripts securely non-trivial.

### Parameters

millis - number of milliseconds to pause execution

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## unbind

unbind( org.autoplot.dom.DomNode src ) → void

unbind the property

### Parameters

src - a DomNode

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## unbind

unbind( org.autoplot.dom.DomNode src, String srcProp, org.autoplot.dom.DomNode dst, String dstProp ) → void

unbind the property

### Parameters

src - a DomNode
srcProp - a String
dst - a DomNode
dstProp - a String

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## waitUntilIdle

waitUntilIdle( ) → void

wait until the application is idle. This does a model.waitUntilIdle, but also checks for the DataSetSelector for pending operations.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## waitUntilIdle

waitUntilIdle( String id ) → void

wait until the application is idle. The id is a convenience to developers when debugging, for example used to trigger breakpoints.

### Parameters

id - string for debugging.

### Returns:

void (returns nothing)

### See Also:

http://autoplot.org/data/tools/reloadAll.jy
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## writeToBufferedImage

writeToBufferedImage( org.autoplot.dom.Application applicationIn ) → java.awt.image.BufferedImage

creates a BufferedImage from the provided DOM. This blocks until the image is ready.

### Parameters

applicationIn - an Application

### Returns:

the image
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## writeToBufferedImage

writeToBufferedImage( ) → java.awt.image.BufferedImage

convenient method for getting an image from the current canvas.

### Returns:

a java.awt.image.BufferedImage
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## writeToPdf

writeToPdf( String filename ) → void

write out the current canvas to a pdf file. TODO: this has issues with the size. See writeToPng(filename). It looks like this might be handled here Note for relative references, this will use the Java process present working directory (PWD) instead of the PWD variable found in scripts

### Parameters

filename - the local file to write the file.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## writeToPdf

writeToPdf( java.io.OutputStream out ) → void

write out the current canvas to a pdf to the output stream. This is to support servers. TODO: this has issues with the size. See writeToPng(filename). It looks like this might be handled here

### Parameters

out - the OutputStream

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## writeToPng

writeToPng( String filename ) → void

write out the current canvas to a png file. TODO: bug 557: this has issues with the size. It's coded to get the size from the DOM, but if it is fitted and has a container it must get size from the container. Use writeToPng( filename, width, height ) instead for now. See writeToPdf(String filename), which appears to have a fix for this that would affect how this is resolved. Note for relative references, this will use the Java process present working directory (PWD) instead of the PWD variable found in scripts

### Parameters

filename - The name of a local file

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## writeToPng

writeToPng( String filename, int width, int height ) → void

write out the current canvas to a png file. TODO: bug 557: this has issues with the size. It's coded to get the size from the DOM, but if it is fitted and has a container it must get size from the container. User writeToPng( filename, width, height ) instead for now. See writeToPdf(String filename), which appears to have a fix for this that would affect how this is resolved. Note for relative references, this will use the Java process present working directory (PWD) instead of the PWD variable found in scripts

### Parameters

filename - The name of a local file
width - the width in pixels of the png
height - the height in pixels of the png

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## writeToPng

writeToPng( String filename, int width, int height, java.util.Map metadata ) → void

write out the current canvas to a png file, using the given size and also insert additional metadata. Note for relative references, this will use the Java process present working directory (PWD) instead of the PWD variable found in scripts

### Parameters

filename - The name of a local file
width - the width in pixels of the png
height - the height in pixels of the png
metadata - if non-null, then write name/values pairs into the PNG Metadata. "Creation Time", "Software" and "plotInfo" are always added.

### Returns:

void (returns nothing)

### See Also:

[search for examples] [view on GitHub] [view on old javadoc] [view source]

## writeToPng

writeToPng( java.awt.image.BufferedImage image, String filename, java.util.Map metadata ) → void

See also writeToPng( OutputStream out )

### Parameters

image - the image to write out.
filename - the name of the output file.
metadata - if non-null, then write name/values pairs into the PNG Metadata. "Creation Time" is always added. http://englishjavadrinker.blogspot.com/2010/09/png-keywords_12.html

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## writeToPng

writeToPng( java.io.OutputStream out ) → void

write out the current canvas to stdout. This is introduced to support servers. TODO: this has issues with the size. See writeToPng(filename).

### Parameters

out - the OutputStream accepting the data, which is not closed.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## writeToSvg

writeToSvg( String filename ) → void

write out the current canvas to a svg file. Note for relative references, this will use the Java process present working directory (PWD) instead of the PWD variable found in scripts

### Parameters

filename - the local file to write the file.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## writeToSvg

writeToSvg( java.io.OutputStream out ) → void

write out the current canvas to stdout. This is introduced to support servers.

### Parameters

out - the OutputStream accepting the data, which is not closed.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]