plot

From DavinciWiki
(Redirected from vplot)
Jump to: navigation, search


Description

WARNING! This function has changed from plot() version 1.72 and used to be called vplot().

This is the graphing function of Davinci. Through the use of this function, data may be altered, formatted and exported to the Gnuplot graphing engine. Some of the options in Davinci do not exist in Gnuplot and many, many advanced features of Gnuplot are not provided in this function.

Features of this function include: plotting objects with independent and non-matching x-axes, ignore values, specifying line widths, colors and style, intelligent labels, and a shortened syntax.

Advanced features: 'ignore above', 'ignore below', errorbars for x, y and xy, printing all gnuplot files to a directory in gnuplot format for professional graph making, handling input structures containing standard elements (.data, .label, .xaxis, .axis, .width, .color, .style)

Arguments and Return Values

Arguments: numeric arrays and gobs of other optional stuff, look below

Return Value:optional string containing the often lengthy Gnuplot command. GnuPlot is launched and displays graph.

Usage

Syntax: plot(object1[, label=STRING][, axis=x/y/z][, xaxis=VAL][, ignore=VAL][, width=INT][, color=INT][, style=INT][, separate=INT][, object2][, ...])


For every plot object (object1, object2, ...) plot() accepts optional keyword arguments to alter the graph of that specific object.

These object-specific keywords must immediately follow the object on which they are meant to operate.

They can be placed in any order whatsoever after the object.

The basic object-specific keywords are: label, xaxis, axis, ignore, width, color, style, separate.


Additionally, plot() accepts global keywords: Xaxis, Axis, Color, Style, Separate, Offset and all ignore values, that will be applied to all graphs and override locally designated keywords values.

These global keywords, which must have a capital first letter, may be placed anywhere in the argument stream, even before the first object.


Below I've outlined the requirements for each optional keyword as well as the shortened syntax in parentheses.

xaxis:(x) A numeric array to use as the x-axis for one object.

axis:(a) A direction to define the axis of plotting for one object. Syntax does not need to be a string in quotes. Ex: axis=y not axis="y"

label:(l) A string to use as the name of the plot object. Does not need to be specifically called. An undefined string in the command buffer will be used as the label.

ignore:(ig) A number that will not be plotted if it is found in the object. This would result in a break in the graph like in the image below.

width:(w) A number > 0 that defines the thickness of the plot.

color:(c) A number > -2 that defines the color of the plot.

style:(st) One of the following: lines, points, linespoints, dots, steps, impulses, boxes, xerrorbars, yerrorbars, xyerrorbars, xerrorlines, yerrorlines or xyerrorlines. Used like axis. Ex. style=lines. not style="lines".

separate:(se) Any number to tell gnuplot to separate each vector of your object and plot them with their own color.


Additional keywords:

iabove: (ia) An "ignore above" y-value above which no data points will be plotted.

ibelow: (ib) An "ignore below" y-value below which no data points will be plotted.

ixabove: (ixa) An "ignore x above" value on the x-axis above which no data points will be plotted.

ixbelow: (ixb) An "ignore x below" value on the x-axis below which no data points will be plotted.

errorbars: (e) Errorbar values for x, y or xy. See examples for format and usage.

smooth: (sm) Gnuplot will fit curves to your data automatically. Options are: csplines or bezier. Syntax is similar to the keyword style.

offset: (o) An optional y-value offset applied cumulatively to each successive plot. (Good for visually separating plots.)

dir: (d) Designates a text string containing the path where Gnuplot files will be written and saved for future use outside of davinci

gcommand: (g) A boolean flag to print the full Gnuplot command to the screen.


plot() also accepts a string as a solitary input that will be passed directly to Gnuplot. This duplicates the functionality of the obsolete function plot() version 1.72.


Finally, plot() is capable of handling standardized structures as plotable objects. These structures must contain the elements of the same naming convention as the keywords.

See Example Using structures for usage.


Also note, if you want to change the range of values plotted on each axis, use the plim function.


Examples

dv> lr = ascii("low_res.txt",format=float)
Apparent file size: 2x11x1
2x11x1 array float, bsq format [88 bytes]

dv> hr = ascii("high_res.txt",format=float)
Apparent file size: 2x72x1
2x72x1 array float, bsq format [576 bytes]

dv> plot(hr[1], xaxis=hr[2], label="High Resolution", ignore=-666, style=linespoints, width=2, color=3, lr[1], xaxis=lr[2], label="Low Resolution", width=7)

or equivalently:

dv> plot(hr[1], x=hr[2], "High Resolution", ig=-666, s=linespoints, w=2, c=3, lr[1], x=lr[2], "Low Resolution", w=7)

will both result in the graph below.

Advanced Examples

Example using xaxis

Example using axis

Example using labels

Example using ignore values

Example using errorbars

Example using style, width and color

Example using dir and gcommand

Example using structures

Example using smooth

Example using offset and separate

Example using shortened syntax

Images

vplot.png

DavinciWiki Mini-Nav Bar

Contents


Contact Developers

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

All other topics

  • See navigation on the left

Related Functions

Recent Core Changes

Modified On: 11-11-2013

Personal tools