Skip to content

scripting.plotcommand

Jeremy Faden edited this page Mar 1, 2020 · 10 revisions

Plot Command

The plot command is modeled off of the plot command from IDL, providing a similar interface. These try to initialize the plot in a configuration which would give an appearance similar to if it were just entered in the address bar, and it is then interactive like any other Autoplot plot. This command is also used to create any of Autoplot's render types, such as spectrograms and lineplots.

Basic Usage

command description
plot( uri, title='my plot' ) plot the URI held in the string "uri", just
as if it were entered in the address bar.
Title is reset.
plot( ds, title='my plot' ) plot the data in the symbol "ds"

Position by index

One can quickly create a plot containing multiple plots by including an integer position for the first argument:

plot( 0, 'vap+cdaweb:ds=OMNI2_H0_MRG1HR&id=DST1800&timerange=Oct+2016', title='DST' )
plot( 1, 'vap+cdaweb:ds=OMNI2_H0_MRG1HR&id=KP1800&timerange=Oct+2016', title='KP' )

If a .vap file is loaded, the index will be the index of the data which is replaced. Often a .vap is loaded and then the script loads particular data. For example:

setLayout(2,2)
plot( 0, 'vap+cdaweb:ds=OMNI2_H0_MRG1HR&id=DST1800&timerange=Oct+2016', title='DST' )
plot( 1, 'vap+cdaweb:ds=OMNI2_H0_MRG1HR&id=KP1800&timerange=Oct+2016', title='KP' )
plot( 2, 'vap+cdaweb:ds=OMNI2_H0_MRG1HR&id=T1800&timerange=Oct+2016', title='Temperature' )
plot( 3, 'vap+cdaweb:ds=OMNI2_H0_MRG1HR&id=N1800&timerange=Oct+2016', title='Density' )

Note, reset() returns to the original state, and often scripts start with a reset() command.

Arbitrary position

One can directly position plots on the canvas using xpos and ypos keywords. These are like normalized coordinates, but also have offsets allowing room for labels.

plot( 'vap+cdaweb:ds=OMNI2_H0_MRG1HR&id=DST1800&timerange=Oct+2016', xpos='20%,80%', ypos='0%,40%-2em' )
plot( 'vap+cdaweb:ds=OMNI2_H0_MRG1HR&id=DST1800&timerange=Oct+2016', xpos='20%,50%-2em', ypos='0%,40%-2em' )
plot( 'vap+cdaweb:ds=OMNI2_H0_MRG1HR&id=DST1800&timerange=Oct+2016', xpos='50%+2em,80%', ypos='40%+2em,100%' )

Keywords (also known as named parameters)

Jython name/value pairs allow control over how the data is plotted.

color

named color, RBG value, or Color enumeration. Examples include 'DarkRed', '0x00FF00', and Color.GREEN.

command description
'DarkRed' One of 140 or so X11 Named Colors
0x00FF00 RRGGBB in hexadecimal.
Color.GREEN color object

symbolSize

the size of the symbols, in pixels roughly, of the symbols.

lineThick

the thickness of the connecting lines, in pixels.

lineStyle

enumeration of values, one of: solid,none,dotfine,dashfine

symbol

the plot symbol, one of: dots triangles cross

symbolFill

the method for filling or not filling the symbol center, one of 'none', 'solid', or 'outline'. (Note this is not saved in .vap files.)

legendLabel

label for the legend box.

title

title for the plot

[xyz]title

axis labels.

[xyz]range

axis ranges, e.g. '0 to 50' or '2016-01-01'

[xyz]tickValues

values to use for tick positions. Use array of strings for times. "+20" will place a tick every twenty units. For times, one can say, as examples: "+4hr" will place a tick every four hours, also "+5days" and "5yr"

[xyz]autoRangeHints

special string for the autoranging. Some examples include:

  • includeZero=T
  • widths=100,1000,10000 to constrain the width to one of the options. These can be ampersand-delimited to combine hints, like so: yautoRangeHints='includeZero=T&widths=100,1000'

[xy]scale

  • data-to-pixel ratio.

renderType

This explicitly sets the renderType, to one of the values: scatter, colorScatter, series, nnSpectrogram, spectrogram, contour, fillToZero, stairSteps, hugeScatter, polar, bounds, digital, stackedHistogram. Further, and to support custom render types, a greater than symbol can be used to pass a control string to the renderer code. For example, "spectrogram>colortable=red_white_blue"

xpos

override horizontal position of plot, eg. '50%+1em,100%-2em'

ypos

override vertical position of plot, eg. '0%+1em,25%-2em', 0 is top

row

the row or rowId of the row to use.

column

the column or columnId of the column to use.

[xy]drawTickLabels

False turns off the x or y tick labels for the plot

Table Of Contents

URIs that Point to Data Files

Download a CDF and Plot it with Autoplot

Load a CDF directly from a website

URIs that Point to Data Servers

Saving to vap files

Loading vap files

Data Sources

CDF Files

HDF/NetCDF Files

Aggregation

CDAWeb

HAPI Servers

Exporting Data

Export Types

Additional controls

Aggregation

Tools

PNGWalk Tool

Data Mash Up

Events List

Run Batch

Advanced Topics

TimeSeriesBrowse and other Capabilities

Events Lists

Caching

Autoranging

Managing Autoplot's Data Cache

Using Autoplot with Python, IDL, and Matlab

Reading data into Python

Reading data into IDL

Reading data into Matlab

QDataSet Data Model

Clone this wiki locally