pygrace module documentation

axis module

class Axis(parent, orientation='x', alt='', onoff='on', scale='Normal', invert='off', type_zero='false', offset=(0.0, 0.0), **kwargs)

Bases: GraceObject

__setattr__(key, value)

Implement setattr(self, name, value).

__str__()

Return str(self).

auto_precision()

Automatically find the precision based on the format of the tick label.

set_format(format, precision=None)
set_lin()
set_log()
set_scale(scale)
class AxisBar(parent, onoff='on', color=1, linestyle=1, linewidth=2, **kwargs)

Bases: GraceObject

__str__()

Return str(self).

_staticType = 'AxisBar'
class AxisLabel(parent, text='', font=4, color=1, char_size=1.75, layout='para', place='normal', place_loc='auto', place_tup=(0, 0.08), **kwargs)

Bases: GraceObject

__setattr__(key, value)

Implement setattr(self, name, value).

__str__()

Return str(self).

_staticType = 'AxisLabel'
class Tick(parent, onoff='on', major=0.5, minor_ticks=1, default=6, place_rounded='true', inout='in', major_size=1.65, major_color=1, major_linewidth=2.0, major_linestyle=1, major_grid='off', minor_size=1.15, minor_color=1, minor_linewidth=2.0, minor_linestyle=1, minor_grid='off', place='both', spec_ticks=(), spec_ticklabels=(), spec_ticktypes=(), spec_type='none', spec_typedefault='major', spec_labeldefault='', **kwargs)

Bases: GraceObject

__setattr__(key, value)

Implement setattr(self, name, value).

__str__()

Return str(self).

_staticType = 'Tick'
set_spec_ticks(major_ticks, minor_ticks, tick_labels=[])

Set special ticks and tick labels in an intuitive manner.

class TickLabel(parent, onoff='on', format='general', prec=3, formula='', append='', prepend='', angle=0, skip=0, stagger=0, place='normal', offset_loc='auto', offset_tup=(0.0, 0.0), start_type='auto', start=0.0, stop_type='auto', stop=0.0, char_size=1.65, font=4, color=1, **kwargs)

Bases: GraceObject

__setattr__(key, value)

Implement setattr(self, name, value).

__str__()

Return str(self).

_staticType = 'TickLabel'

base module

class BaseSet(items)

Bases: object

This is a container class that stores objects by name and index. This is meant to be subclassed.

__contains__(value)

Returns true if either integer index or string value is in.

__getitem__(value)

Allow retreival by index or name. Error is thrown if neither index or name is in the set.

__iter__()
__len__()
__str__()

Returns the string representation of each item in the set (sorted by index and separated by newlines).

add_item(ItemClass, *args, **kwargs)
get_item_by_index(index)
get_item_by_name(name)
class GraceObject(parent, attrs, *args, **kwargs)

Bases: object

Since most of the classes in pygrace are basically just dictionaries with special string representations and a place to specify defaults for attributes, this class does the work that most of the classes need to do. The __init__ method just sets all of the parameters passed as the values of the attributes. Also, the __getitem__ method returns a string representation of the attribute (with an option to pass a formatting command by setting the appropriate value in _formatting_template.

In addition, the parents and children of each object are recorded, so that all objects in a tree can access each other.

__eq__(other)

Two objects are the same if all of their attributes are the same. Otherwise they are not the same.

__getitem__(key)

Always returns a formatted string representation of an attribute by checking in self._formatting_template

__hash__()

Return hash(self).

__ne__(other)

Two objects are the same if all of their attributes are the same. Otherwise they are not the same.

__setattr__(key, value)

Implement setattr(self, name, value).

_check_membership(key, value, set)

Throw an error if value is not in set (set can be any container with a __contains__ method defined.

_check_range(key, value, min, max, includeMin=True, includeMax=True)

Throw error if value is not in between min and max.

_check_type(allowedTypes, key, value)

Throw error if value is not of a type in allowedTypes.

_format_color(value)

Throw error if color is not defined, otherwise return string representation of color (either integer or quoted string)

_format_font(value)

Throw error if font is not defined, otherwise return string representation of font (either integer or quoted string)

_latex_friendly(string)

Return a string that won’t make latex complain, for example escape all underscores.

If there is no parent, set self as root. Otherwise, record who the parent and the root of the tree are. Also, this records self in the list of children of the parent.

_make_reference_list()
_set_kwargs_attributes(attrDict)

This sets all of the arguements that are given as default arguments as the attributes of the class.

add_color(red, green, blue, name=None)

Calls the add_color method of the root of the tree. The method must be overwritten by the root to avoid infinite recursion.

cheatsheet(filename)

produce a latex file listing the object’s attributes and methods

children()
configure(**kwargs)
configure_group(*args, **kwargs)
copy_format(other, all=True)
scale_suffix(value, suffix, all=True)

Scale all attributes with name ending in ‘suffix’ to value times the original value. If ‘all’ is True, then same is set for all children recursively too.

set_colors(color, all=False)

Set all colors to given value. Recursive if ‘all’ is True.

set_data_linewidths(width, all=True)

Set all linewidths for datasets to given value. Recursive if ‘all’ is True.

set_fonts(font, all=True)

Set all fonts to given value. Recursive if ‘all’ is True.

set_linewidths(width, all=True)

Set all linewidths to given value. Recursive if ‘all’ is True.

set_suffix(value, suffix, all=True)

Set all attributes with name ending in ‘suffix’ to value. If ‘all’ is True, then same is set for all children recursively too.

write_cheatsheet(filename)

colors module

class Color(index, red, green, blue, name='')

Bases: object

Object that stores a mapping between an index an a name for a color, as well as the RGB tuple of the color.

__str__()

Return str(self).

change_opacity(percent)
rgb()

Return RGB tuple.

class ColorBrewerScheme(name, n=None, reverse=False, randomize_order=False, seed=None)

Bases: ColorScheme

Instantiate with a name of the color brewer scheme (and an optional number of colors – default is the maximum that is explicitly enumerated in the colorbrewer definition. The first two colors (0 and 1) are always white and black.

class ColorScheme(items)

Bases: BaseSet

This subclass of the base set has a method that checks for conflicts in the color scheme.

add_color(red, green, blue, name=None)
change_opacity(percent, exclude_black=False)
class DefaultColorScheme

Bases: ColorScheme

Keepin’ it real with the original xmgrace color scheme.

class MarkovChainColorScheme(seed, n, reverse=False, maxstep=25)

Bases: ColorScheme

Instantiate with random seed and the number of colors. The first two colors (0 and 1) are always white and black. This identifies a Markov Chain of colors after that.

class RandomColorScheme(seed, n, reverse=False)

Bases: ColorScheme

Instantiate with random seed and the number of colors. The first two colors (0 and 1) are always white and black.

dataset module

class AnnotatedValue(parent, onoff='off', type=4, char_size=0.65, font=4, color=1, rot=0, format='general', prec=3, prepend='', append='', offset=(0.0, 0.0), **kwargs)

Bases: GraceObject

__setattr__(key, value)

Implement setattr(self, name, value).

__str__()

Return str(self).

_staticType = 'AnnotatedValue'
class Baseline(parent, type=0, onoff='off', **kwargs)

Bases: GraceObject

__setattr__(key, value)

Implement setattr(self, name, value).

__str__()

Return str(self).

_staticType = 'BaseLine'
class DataSet(parent, data, index, type='xy', hidden='false', dropline='off', comment='', legend='', **kwargs)

Bases: GraceObject

__setattr__(key, value)

Implement setattr(self, name, value).

__str__()

Return str(self).

_repr_data()
_staticType = 'DataSet'
data_bounds()
limits(only_visible=True)
smallest_positive(only_visible=True)
class ErrorBar(parent, onoff='on', place='both', color=1, pattern=1, size=1.0, linewidth=2.0, linestyle=1, riser_linewidth=2.0, riser_linestyle=1, riser_clip='off', riser_clip_length=0.1, **kwargs)

Bases: GraceObject

__setattr__(key, value)

Implement setattr(self, name, value).

__str__()

Return str(self).

_staticType = 'ErrorBar'
class Fill(parent, type=0, rule=0, color=1, pattern=1, **kwargs)

Bases: GraceObject

__setattr__(key, value)

Implement setattr(self, name, value).

__str__()

Return str(self).

_staticType = 'Fill'
class Line(parent, type=1, linestyle=1, linewidth=2.0, color=1, pattern=1, **kwargs)

Bases: GraceObject

__setattr__(key, value)

Implement setattr(self, name, value).

__str__()

Return str(self).

_staticType = 'Line'
class Symbol(parent, shape=1, size=0.5, color=1, pattern=1, fill_color=1, fill_pattern=1, linewidth=1.0, linestyle=1, char=65, char_font=0, skip=0, **kwargs)

Bases: GraceObject

__setattr__(key, value)

Implement setattr(self, name, value).

__str__()

Return str(self).

_staticType = 'Symbol'

drawing_objects module

class DrawBox(parent, onoff='on', loctype='view', lowleft=(0, 0), upright=(1, 1), linestyle=1, linewidth=2.0, color=1, fill_color=1, fill_pattern=1, **kwargs)

Bases: DrawingObject

__str__()

Return str(self).

limits()

Find the limits of a DrawBox for autoscaling axes (among other things?)

class DrawLine(parent, onoff='on', loctype='view', start=(0, 0), end=(1, 1), linestyle=1, linewidth=2.0, color=1, arrow=0, arrow_type=0, arrow_length=1, arrow_layout=(1.0, 1.0), **kwargs)

Bases: DrawingObject

__setattr__(key, value)

Implement setattr(self, name, value).

__str__()

Return str(self).

limits()

Find the limits of a DrawLine for autoscaling axes (among other things?)

class DrawText(parent, onoff='on', loctype='view', x=0, y=0, color=1, rot=0, font=4, just=0, char_size=1.65, text='DrawObjText', **kwargs)

Bases: DrawingObject

__str__()

Return str(self).

limits()

Find the limits of a DrawBox for autoscaling axes (among other things?)

class DrawingObject(parent, attrs, *args, **kwargs)

Bases: GraceObject

_make_header(objectString)
_staticType = 'DrawingObject'
limits()

This method must be overwritten in all subclasses of DrawingObject for autoscale features to work properly.

smallest_positive()

Find the smallest positive coordinate of each drawing object.

class LabelledPoint(parent, onoff='on', loctype='view', x=0, y=0, text_color=1, rot=0, font=4, just=14, char_size=1.0, text='DrawObjText', r=1, linestyle=1, linewidth=2.0, outline_color=1, fill_color=1, fill_pattern=1, **kwargs)

Bases: DrawingObject

__str__()

Return str(self).

limits()

Find the limits of a LabelledPoint for autoscaling axes (among other things?)

class MultiLegend(parent, onoff='on', loctype='view', x=0, y=0, text_color=1, rot=0, font=4, just=14, char_size=1.0, text='DrawObjText', r=1, linestyle=1, linewidth=2.0, outline_color=1, fill_color=1, fill_pattern=1, **kwargs)

Bases: DrawingObject

__str__()

Return str(self).

limits()

Find the limits of a MultiLegend for autoscaling axes (among other things?)

extensions module

fonts module

class Font(index, name)

Bases: object

Object that stores a mapping between an index an a name for a font, and outputs a string representation suitable for XMGrace.

__str__()

Return str(self).

class FontSet(items)

Bases: BaseSet

A dummy subclass for storing fonts. Perhaps there will be some way to modify fonts in the future.

graph module

class Frame(parent, type=0, linestyle=1, linewidth=2.0, color=1, pattern=1, background_color=0, background_pattern=0, **kwargs)

Bases: GraceObject

__setattr__(key, value)

Implement setattr(self, name, value).

__str__()

Return str(self).

_staticType = 'Frame'
class Graph(parent, index, onoff='on', hidden='false', type='XY', stacked='false', bar_hgap=0.0, **kwargs)

Bases: GraceObject

__setattr__(key, value)

Implement setattr(self, name, value).

__str__()

Return str(self).

_staticType = 'Graph'
add_dataset(data, cls=<class 'pygrace.dataset.DataSet'>, *args, **kwargs)
add_drawing_object(cls, *args, **kwargs)
alldata()
autoformat(printWidth=6.5)
autoscale(padx=0, pady=0, only_visible=True)
autoscale_old()
autoscalex(pad=0, only_visible=True)
autoscaley(pad=0, only_visible=True)
autotick()

Automatically generate ticks based on world coords.

autotickx()

Automatically generate x-axis ticks based on world coords.

autoticky()

Automatically generate y-axis ticks based on world coords.

calculate_sizes(printWidth)
calculate_ticks(iMin, iMax, lowTarget=3, highTarget=7, scale='Normal')
data_limits(only_visible=True)
data_smallest_positive(only_visible=True)
drawing_object_limits()
drawing_object_smallest_positive()
format_for_print(printWidth)
get_dataset(num)
get_view()
get_world()
half_open()

Make frame half open

limits(only_visible=True)
linx()
linxy()
liny()
logx()
logxy()
logy()
move_dataset_backward(dataset)

Move data set backward by one dataset. This emulates the functionality of the xmgrace GUI.

move_dataset_forward(dataset)

Move data set forward by one dataset. This emulates the functionality of the xmgrace GUI.

move_dataset_to_back(dataset)

Move data set to the back. This emulates the functionality of the xmgrace GUI.

move_dataset_to_front(dataset)

Move data set to the front. This emulates the functionality of the xmgrace GUI.

remove_extraworld_drawing_objects()

Remove drawing objects that are outside of the world coordinates. Get it, ‘extraworld’ is like ‘extra-terrestrial’.

set_dataset_order(datasets)

Specify the order of the data sets.

set_different_colors(skip=1, attr='name', exclude=('White',), colorsList=[])

Set datasets in graph to different colors. This function behaves similarly to the similar function in the xmgrace GUI. Can alternatively specify a list of colors for ordering the colors.

set_different_linestyles(skip=1, attr='index', exclude=(0,), linestylesList=[])

Set datasets in graph to different linestyles. This function behaves similarly to the similar function in the xmgrace GUI. Can alternatively specify a list of linestyles for ordering the line styles.

set_different_linewidths(skip=0.5, start=0.5, linewidthsList=[])

Set datasets in graph to different linewidths. This function behaves similarly to the similar function in the xmgrace GUI. Can alternatively specify a list of line widths.

set_different_symbols(skip=1, attr='index', exclude=(0,), symbolsList=[])

Set datasets in graph to different symbols. This function behaves similarly to the similar function in the xmgrace GUI. Can alternatively specify a list of symbols for ordering the symbol shapes.

set_labels(xLabel, yLabel)
set_view(xmin, ymin, xmax, ymax)
set_world(xMin, yMin, xMax, yMax)
set_world_to_limits(epsilon=1e-12)
smallest_positive(only_visible=True)
class Legend(parent, onoff='on', loctype='view', loc=(0.85, 0.75), box_color=1, box_pattern=1, box_linewidth=2.0, box_linestyle=1, box_fill_color=0, box_fill_pattern=1, font=4, char_size=1.65, color=1, length=3, vgap=1, hgap=1, invert='false', **kwargs)

Bases: GraceObject

__setattr__(key, value)

Implement setattr(self, name, value).

__str__()

Return str(self).

_staticType = 'Legend'
class Subtitle(parent, text='', font=4, color=1, size=1.75, **kwargs)

Bases: GraceObject

__str__()

Return str(self).

_staticType = 'Subtitle'
class Title(parent, text='', font=4, color=1, size=1.75, **kwargs)

Bases: GraceObject

__str__()

Return str(self).

_staticType = 'Title'
class View(parent, xmin=0.15, xmax=1.15, ymin=0.15, ymax=0.85, **kwargs)

Bases: GraceObject

__str__()

Return str(self).

_staticType = 'View'
class World(parent, xmin=0, xmax=1, ymin=0, ymax=1, stack_world=(0, 0, 0, 0), znorm=1, **kwargs)

Bases: GraceObject

__setattr__(key, value)

Implement setattr(self, name, value).

__str__()

Return str(self).

_staticType = 'World'

interactive module

Instructions for pygrace: Import the grace class >>> from pygrace import grace Instantiate the grace class >>> pg = grace() Get help >>> pg.doc()

class Graph(grace, gID)

Bases: object

_errPlot(X, Y, dy=None, symbols=None, styles=None, pType='xydy')

Line plot with error bars – for internal use only Do not use this! Use plot() with dy=something instead.

_flush()
_limHelper(ax, lower, upper)
_send(cmd)
_send_2(var, X, Y)
_send_3(var, X, Y, Z)
clear()

Erase all lines from the plot and set hold to 0

histoPlot(y, x_min=0, x_max=None, dy=None, edges=0, fillcolor=2, edgecolor=1, labeled=0)

Plot a histogram

y contains a vector of bin counts By default, bin counts are plotted against bin numbers unless x_min and/or x_max are specified. By default, edges == 0, where x_min and x_max specify the lower and upper edges of the first and last bins, respectively. Otherwise, x_min and x_max specify the centers of the first and last bins. If dy is specified symmetric errorbars are plotted. fillcolor and edgecolor are color numbers (0-15) If labeled is set to 1 then labels are placed at each bin to show the bin count.

Note that this function can create two datasets in grace if you specify error bars.

hold(onoff=None)

Turn on/off overplotting for this graph.

Call as hold() to toggle, hold(1) to turn on, or hold(0) to turn off. Returns the previous hold setting.

kill()

Kill the plot

legend(labels)

Set the legend labels for the plot Takes a list of strings, one string per dataset on the graph. Note: <ctrl>-L allows you to reposition legends using the mouse.

pexec(cmd)
plot(X, Y=None, dy=None, symbols=None, styles=None)

2-D line plot, with or without error bars

The arguments should be Numpy arrays of equal length. X, Y, and dy can be rank-1 or rank-2 arrays (vectors or matrices). In rank-2 arrays, each column is treated as a dataset. X can be rank-1, even if Y and DY are rank-2, as long as len(X) == len(Y[:,0]).

If dy is not None then it must be the same shape as Y, and symmetric error bars will be plotted with total height 2*dy. Setting symbols=1 will give each dataset a unique symbol. Setting styles=1 will give each dataset a unique linestyle

redraw()

Refresh the plot

subtitle(titlestr)

Change the subtitle of the plot

title(titlestr)

Change the title of the plot

xlabel(label)

Change the x-axis label

xlimit(lower=None, upper=None)

Set the lower and/or upper bounds of the x-axis.

ylabel(label)

Change the y-axis label

ylimit(lower=None, upper=None)

Set the lower and/or upper bounds of the y-axis.

class Process(bufsize=-1, debug=0, fixedsize=None, ask=None, safe=None, batch=None, project=None)

Bases: object

Interface to an instance of a running xmgrace program

Start xmgrace and read from the pipe controlled by pygrace.

Input:
bufsize – int, size of the buffer used. xmgrace won’t

respond to sent commands that haven’t been flushed from the buffer, however the speed should improve with buffering. Default is -1, which provdes full buffering. bufsize=0 signifies no buffering.

debug – bool, if True, each command passed to xmgrace is

also sent to stderr. Default is to not debug.

fixedsize – tuple, used to set the fixed size of the

grace canvas. Default is None, which causes the grace window to be freely resizable.

ask – bool, if True, xmgrace will ask before overwriting

a file, clearing the display, etc. Default is to not ask.

safe – bool, if True, xmgrace will ignore commands like `saveall’,

which write to files. Default is not to be overly safe.

batch – str, path to command batch_file to be executed on startup

of xmgrace. Default is to not use a batch file.

project – str, path to xmgrace project file (.agr) to be executed

on startup. Default is to use the xmgrace default project.

__call__(com)

send a command to xmgrace, then flush the write queue

__del__()

disconnect from a xmgrace process, but leave xmgrace running

If a Process instance is deleted without calling exit(), it disconnects from xmgrace without killing xmgrace. This assumes that the user may want to continue manipulating the graph through the xmgrace GUI interface. To force xmgrace to terminate, use self.exit()

command(com)

send a command to xmgrace

Input:

com – str, command to send to xmgrace

A newline will be added to the command. Unless the instance of the Process class was created using bufsize=0, the interface will be buffered, and thus the execution of the command may be delayed. To flush the buffer, use self.flush(), or alternately, send commands that are automatically flushed, using self(com).

exit()

cause xmgrace to exit

nicely ask xmgrace to exit (i.e. terminate), however, if xmgrace doesn’t respond then try to kill the process with a SIGTERM.

flush()

flush any pending commands for xmgrace

is_open()

True, if the pipe has not been closed

class Project(*args, **kwds)

Bases: object

Start xmgrace and read from the pipe controlled by pygrace.

Input:
bufsize – int, size of the buffer used. xmgrace won’t

respond to sent commands that haven’t been flushed from the buffer, however the speed should improve with buffering. Default is -1, which provdes full buffering. bufsize=0 signifies no buffering.

debug – bool, if True, each command passed to xmgrace is

also sent to stderr. Default is to not debug.

fixedsize – tuple, used to set the fixed size of the

grace canvas. Default is None, which causes the grace window to be freely resizable.

ask – bool, if True, xmgrace will ask before overwriting

a file, clearing the display, etc. Default is to not ask.

safe – bool, if True, xmgrace will ignore commands like `saveall’,

which write to files. Default is not to be overly safe.

batch – str, path to command batch_file to be executed on startup

of xmgrace. Default is to not use a batch file.

project – str, path to xmgrace project file (.agr) to be executed

on startup. Default is to use the xmgrace default project.

__del__()

Destroy the pipe but leave the grace window open for interaction. This is the best action for the destructor so that unexpected crashes don’t needlessly destroy plots.

__getitem__(item)

Access a specific graph. Can use either p[num] or p[row, col].

_flush()
_send(cmd)
exit()

Nuke the grace session. (more final than Project.__del__())

focus(row, col)

Set the currently active graph

multi(rows, cols, offset=0.1, hgap=0.1, vgap=0.15)

Create a grid of graphs with the given number of <rows> and <cols>

pexec(cmd)
redraw()

Refresh the plot

resize(xdim, ydim, rescale=1)

Change the page dimensions (in pp). If rescale==1, then also rescale the current plot accordingly. Don’t ask me what a pp is–I don’t know.

saveall(filename='xmgrace.agr', format=None)

Save the current plot

Default format is Grace ‘.agr’ file, but other possible formats are: x11, postscript, eps, pdf, mif, svg, pnm, jpeg, png, metafile

Note: Not all drivers are created equal. See the Grace documentation or caveats that apply to some of these formats.

copyright()
grace(*args, **kwds)

Start xmgrace and read from the pipe controlled by pygrace.

Input:
bufsize – int, size of the buffer used. xmgrace won’t

respond to sent commands that haven’t been flushed from the buffer, however the speed should improve with buffering. Default is -1, which provdes full buffering. bufsize=0 signifies no buffering.

debug – bool, if True, each command passed to xmgrace is

also sent to stderr. Default is to not debug.

fixedsize – tuple, used to set the fixed size of the

grace canvas. Default is None, which causes the grace window to be freely resizable.

ask – bool, if True, xmgrace will ask before overwriting

a file, clearing the display, etc. Default is to not ask.

safe – bool, if True, xmgrace will ignore commands like `saveall’,

which write to files. Default is not to be overly safe.

batch – str, path to command batch_file to be executed on startup

of xmgrace. Default is to not use a batch file.

project – str, path to xmgrace project file (.agr) to be executed

on startup. Default is to use the xmgrace default project.

session(*args, **kwds)

Start xmgrace and read from the pipe controlled by pygrace.

Input:
bufsize – int, size of the buffer used. xmgrace won’t

respond to sent commands that haven’t been flushed from the buffer, however the speed should improve with buffering. Default is -1, which provdes full buffering. bufsize=0 signifies no buffering.

debug – bool, if True, each command passed to xmgrace is

also sent to stderr. Default is to not debug.

fixedsize – tuple, used to set the fixed size of the

grace canvas. Default is None, which causes the grace window to be freely resizable.

ask – bool, if True, xmgrace will ask before overwriting

a file, clearing the display, etc. Default is to not ask.

safe – bool, if True, xmgrace will ignore commands like `saveall’,

which write to files. Default is not to be overly safe.

batch – str, path to command batch_file to be executed on startup

of xmgrace. Default is to not use a batch file.

project – str, path to xmgrace project file (.agr) to be executed

on startup. Default is to use the xmgrace default project.

parser module

class XYParser(*args, **kwargs)

Bases: OptionParser

parse_args(*args, **kwargs)
parse_args(args[string] = sys.argv[1:],

values : Values = None)

-> (values : Values, args : [string])

Parse the command-line options found in ‘args’ (default: sys.argv[1:]). Any errors result in a call to ‘error()’, which by default prints the usage message to stderr and calls sys.exit() with an error message. On success returns a pair (values, args) where ‘values’ is a Values instance (with all your option values) and ‘args’ is the list of arguments left over after parsing options.

project module

class Project(width=792, height=612, background_color=0, background_fill='off', version='50114', verbose=False, colors=None, **kwargs)

Bases: GraceObject

__setattr__(key, value)

Implement setattr(self, name, value).

__str__()

Return str(self).

_header_string()
add_color(red, green, blue, name=None)

Calls the add_color method of the root of the tree. The method must be overwritten by the root to avoid infinite recursion.

add_drawing_object(cls, *args, **kwargs)
add_graph(cls=<class 'pygrace.graph.Graph'>, *args, **kwargs)
autoformat(printWidth=6.5)
autoscale(padx=0, pady=0)
autoscale_same(padx=0, pady=0, graphs=(), exclude_graphs=())

Autoscale all graphs in a this MultiPlotProject to have the same x,y world coordinates.

autoscalex_same(pad=0, graphs=(), exclude_graphs=())

Autoscale all x-axes to have the same world coordinates

autoscaley_same(pad=0, graphs=(), exclude_graphs=())

Autoscale all y-axes to have the same world coordinates

clone_graph(graph, cls=<class 'pygrace.graph.Graph'>, *args, **kwargs)

Clone graph ‘graph’ by adding a new graph (the clone) and then copying the format of ‘graph’.

This is a convenience method which is handy for graphs that have drawing objects in them. When drawing objects are in a graph, the drawing object is placed over the axes, frame, etc. and it makes the graphs rather ugly looking.

get_canvas_dimensions()

Get dimensions of the canvas

get_eps_frame_coords()

For each graph, obtain the eps coordinates of the frame within the figure. This is useful for aligning things in external programs such as xfig.

get_graph(index)
printfile(filename='temp.eps', filetype=None)

Use gracebat to output a image file of the specified type. The allowed types are:

X11 PostScript EPS MIF SVG PNM JPEG PNG Metafile

saveall(filname='temp.agr')

save the Project to a xmgrace project (.agr) file

set_landscape()
set_portrait()
set_world_same(xmin, ymin, xmax, ymax)

Rescale all graphs in a MultiPlotProject to have the same x,y world coordinates.

write_agr(filename='temp.agr')

save the Project to a xmgrace project (.agr) file

write_file(filename='temp.eps', filetype=None)

Use gracebat to output a image file of the specified type. The allowed types are:

X11 PostScript EPS MIF SVG PNM JPEG PNG Metafile

class Timestamp(parent, onoff='off', x=0.03, y=0.03, color=1, font=4, rot=0, char_size=1.0, **kwargs)

Bases: GraceObject

A string representation of the time is created at time of printing.

__str__()

Return str(self).

_staticType = 'Timestamp'

styles module