# Class Plot2Example

java.lang.Object
uk.ac.starlink.ttools.build.Plot2Example

public class Plot2Example extends Object
Instances of this class represent a given figure plotted using the plot2 plotting classes and some externally supplied data. A number of instances are defined, representing examples of various different aspects of the plotting classes. The main method provides options for external invocation to plot the figures to the screen or to external graphics files, list the required data files, etc.

Since:
  1 Mar 2017
Author:
  Mark Taylor

## Constructor Summary

Constructors
Constructor
Description
`Plot2Example(String label, uk.ac.starlink.ttools.build.Plot2Example.Context context, uk.ac.starlink.ttools.build.Plot2Example.PlotTask task, String[] params)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`Picture`
`createPicture(String[] extraParams)`
Constructs an object giving this example's plot ready for output.
`static Map<String,String>`
`getExamplesXml()`
Returns a map from the names of the known examples to their XML invocation text.
`String`
`getLabel()`
Returns this example's name.
`String[]`
`getLines()`
Returns the lines representing the stilts command you would type to execute this example.
`String[]`
`getRequiredTableNames()`
Returns the names of table files that must be in place for this example to run.
`String`
`getXml()`
Returns XML text representing the stilts command you would type to execute this example.
`static void`
`main(String[] args)`
Main method.
`void`
`testParams()`
Tests that this example can execute, but does not run the actual plotting code.

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### Plot2Example

public Plot2Example(String label, uk.ac.starlink.ttools.build.Plot2Example.Context context, uk.ac.starlink.ttools.build.Plot2Example.PlotTask task, String[] params)
Constructor.

Parameters:
  `label` - name of example
  `context` - example execution context
  `task` - the STILTS task used for the plot
  `params` - array of [*!]name=value pairs giving parameters; a prepended "*" indicates emphasis; a prepended "!" hides it from user view; `value` part may be enclosed in single quotes; a null in the list signifies line break for formatting

## Method Details

### getLabel

public String getLabel()
Returns this example's name.

Returns:
  identification string

### getLines

public String[] getLines()
Returns the lines representing the stilts command you would type to execute this example.

Returns:
  one or more lines of text; intended to be presented in a fixed-width font

### getXml

public String getXml()
Returns XML text representing the stilts command you would type to execute this example.

Returns:
  XML text wrapped in a <verbati> element

### createPicture

public Picture createPicture(String[] extraParams) throws IOException, uk.ac.starlink.task.TaskException, InterruptedException, uk.ac.starlink.util.LoadException
Constructs an object giving this example's plot ready for output.

Parameters:
  `extraParams` - additional name=value strings to apply when doing the plot
Returns:
  picture
Throws:
  `IOException`
  `uk.ac.starlink.task.TaskException`
  `InterruptedException`
  `uk.ac.starlink.util.LoadException`

### testParams

public void testParams() throws Exception
Tests that this example can execute, but does not run the actual plotting code. Required external data files must be in place.

Throws:
  `Exception`

### getRequiredTableNames

public String[] getRequiredTableNames()
Returns the names of table files that must be in place for this example to run.

Returns:
  array of required table names

### getExamplesXml

public static Map<String,String> getExamplesXml()
Returns a map from the names of the known examples to their XML invocation text.

Returns:
  label->verbatim command elements

### main

public static void main(String[] args) throws Exception
Main method. This is intended for invocation from the stilts/topcat build systems.

Use the `-help` flag for usage information.

Throws:
  `Exception`