pplot

From DavinciWiki
Jump to: navigation, search

Description

Plot one or more objects, with many options. Excellent for making spectral plots.

As of version 1.04 pplot() now uses plot to handle multiple x-axes.

See pplot_tutorial and Plotting Spectra with pplot for more examples.

Arguments and Return Values

Arguments: numeric arrays and strings

Return Value: none. GnuPlot is launched and displays graph.

Usage

Syntax: pplot({data1, data2, ...}, {color1, color2, ...}, {label1, label2, ...}, xaxis=xaxis, xlabel='string', ylabel='string', plot_title='string', key='string', date=1, x1=val, x2=val, y1=val, y2=val, ignore=val, noplim=1, linespoints=1, lw=val, [stack = FLOAT] [wave=1 OR cm=1], emiss=1, [tes=1 OR mtes=1 OR themis=1 OR lab1=1], pdf='filename', portrait=1, font_size=val, print=1, mono=1)

Only data is required. All other arguments are optional.


Arguments:

{data1, data2, ...} is a structure of data elements to plot. Each data element can be a vector or array. Data elements can be a single standard ASU structure with fields called data, label, and xaxis that are used appropriately. Braces {} can be omitted if only plotting 1 variable; see examples. pplot prefers having data to be plotted in z-axis (same as xplot 'axis=z'), but it will understand any one-dimensional input.


{color1, color2, ..} are the indices of colors in your .Xdefaults. If you don't specify the color, colors will cycle through different color for each vector. The default colors vary by operating system. For GnuPlot in Unix, the color indices are:

1 red

2 green

3 blue

4 magenta

5 cyan

6 brown

7 yellow-orange (brighter orange)

8 red-orange (darker orange)

After 8, the colors repeat, so 9 is red, 10 is green, and so on.


{'label1', 'label2', ...} are labels for each data element in the key

It doesn't matter if labels are input before colors. pplot can tell the difference, based on the data types.

pplot({data1, data2}, {"Label 1", "Label 2"}, {color1, color2})

is the same as

pplot({data1, data2}, {color1, color2}, {"Label 1", "Label 2"})


xaxis is a user-supplied x-axis vector. If no x-axis option is specified, default is zero-based index (i.e. 0, 1, 2...). If each data element has a different x-axis, you can give it a structure of x-axes:

pplot({data1, data2, data3}, {"Label 1", "Label 2", "Label 3"}, xaxis={x1, x2, x3})

pplot will automatically resample your data and plot with a common x-axis.

stack = f offsets every plot from its predicesor by f (use carefully)

Labels:

xlabel = "string for x-axis label"

ylabel = "string for y-axis label"

plot_title = "string for plot title"

key = 'top bottom left right outside below' (can use several as appropriate) or key = 'x, y' in plot x, y units. (e.g. key='1300, .92')

date = 1 to include date and time in plot title


Plot range:

x1 = min x for plot range

x2 = max x for plot range

y1 = min y for plot range

y2 = max y for plot range

ignore = user-supplied y value that will not be plotted (useful if some values in spectrum are 0 and you don't want a lot of vertical lines)

noplim = 1 Don't change plot limits inside pplot


Plot style:

linespoints = 1 to display markers at each data point

lw = line weight/width (default is 3)


Built-in axes:

wave = 1 to make standard Wavelength/Wavenumber X-axis (wavelengths in microns along the bottom x-axis, wavenumbers in cm-1 along the top x-axis)

cm = 1 to make standard Wavenumber/Wavelength X-axis (wavenumbers in cm-1 along the bottom x-axis, wavelengths in microns along the top x-axis)

emiss = 1 to make standard Emissivity Y-axis (displays y-values ranging from 0.80 to 1.01; equivalent to y1=0.80 and y2=1.01)

tes = 1 to make standard TES plot (like wave=1, with x range from 200/cm to 1700/cm)

mtes = 1 to make standard Mini-TES plot (like wave=1, with x range from 400/cm to 1800/cm)

themis = 1 to make standard THEMIS plot (like wave=1, with x range from 600/cm to 1500/cm)

lab1 = 1 to make standard ASU lab1 plot (like wave=1, with x range from 200/cm to 2000/cm)


To output a file:

pdf = 'filename' Basename for output of .ps file

portrait = 1 to make a portrait plot (default is landscape)

font_size = point size for axes and key labels in output file (default is 22)

print = 1 to print directly to your default printer

mono = 1 for black and white plot (.ps only)

Examples

See pplot_tutorial for sample cases.

dv> ASU_spec
170x923x1 array of double, bsq format [1,255,280 bytes]
dv> ASU_head
Text Buffer with 170 lines of text
    1: 456 Actinolite
    2: 603 Aegirine (aka Acmite)
    3: 438 Albite
    4: 454 Albite
    5: 560 Albite
    6: 462 Almandine
    7: 568 Andalusite
    8: 434 Andesine
    9: 561 Andesine
    10: 498 Anhydrite
dv> ASU_wvn
1x923x1 array of double, bsq format [7,384 bytes]
dv> pplot({ASU_spec[92,],ASU_spec[150,]}, {ASU_head[,92],ASU_head[,150]}, xaxis=ASU_wvn,
cm=1, emiss=1, plot_title="Spectra", key="bottom right", ylabel="Emissivity", lw=1)

Images

Result of pplot command in example

DavinciWiki Mini-Nav Bar

Contents


Contact Developers

  • davinci-dev [AT] mars.asu.edu

All other topics

  • See navigation on the left

Major Sub-Functions

Related Functions

Recent Library Changes

Created On: 01-10-2008
Modified On: 03-09-2012

Personal tools