11. Plotting in XmGrace

A high-level Python interface to the Grace plotting package XmGrace

  • one line command plotting: plot of numpy arrays and dataArrays without predefining Data or Symbol objects.
  • symbol, line and error are defined by list arguments as line=[1,0.5,3]
  • Older functionality still works and can be used for more sophisticated output.

Example

import jscatter as js
data=js.dL('exampleData/iqt_1hho.dat')               #read data from test directory into dataList
p=js.grace(3,2)                      #make plot with size 2,3
# symbol=[-1,0.3,-1]  -> increment symbols,size 0.3, increment colors
# line  =[1,1,'']     -> line type 1, line thickness 1, sync colors to symbol
# legend='Q=$q'  takes the value of the parameter q from the data like in shell substitution
#
p.plot(data,symbol=-1,line=[1,1,''],legend='Q=$q')
#
# finetuning only if needed
# make axes, legend, title, and subtitle to get nice plot
p.yaxis(min=0.09,max=1.1,scale='l',label='I(Q,t)/I(Q,0)',charsize=1.50)
p.xaxis(min=0.0,max=250,label='fouriertime t / ns ',charsize=1.50)
p.legend(x=190,y=1)
p.title('An example for the intermediate scattering function in \n Neutron Spinecho Spectroscopy',size=1)
p.subtitle('colors of lines are sync to symbol color')
# add a text
p.text('Here we place a text just as demo\n at the last point of this dataset',x=90,y=0.18,charsize=1)
p.save('testdata.agr') #as grace file
p.save('testdata',format='jpeg') #as jpg file

Originally, this code of GracePlot started out from: Nathaniel Gray <n8gray@caltech.edu>, updated by Marcus H. Mendenhall, MHM ,John Kitchin, Marus Mendenhall

  • original source -> sourceforge.net/projects/graceplot/ 2014 and according to that site: License: GNU General Public License version 2.0 (GPLv2)
  • Consequently this file is still under GNU General Public License version 2.0 (GPLv2)

Ralf Biehl JCNS1 & ICS1 Forschungszentrum Juelich 2014

Resources

11.1. GracePlot

GracePlot.plot(*args, **kwargs) Shortcut for sending the command directly to the appropriate graceGraph object see below
GracePlot.multi(rows, cols[, offset, hgap, vgap]) Create a grid of graphs with the given number of <rows> and <cols>
GracePlot.stacked(number, hshift, vshift[, …]) Creates a stacked chart with shifted graphs in the frame
GracePlot.clear(*args, **kwargs) Shortcut for sending the command to current graceGraph see below
GracePlot.exit() Nuke the grace session.
GracePlot.legend(*args, **kwargs) Shortcut for sending the command to current graceGraph
GracePlot.save(filename[, size, dpi, format]) Save the current plot
GracePlot.subtitle(*args, **kwargs) Shortcut for sending the command to current graceGraph see below
GracePlot.text(*args, **kwargs) Writes text to graph at specified position.
GracePlot.title(*args, **kwargs) Shortcut for sending the command to current graceGraph see below
GracePlot.updateall() Update the GUI (graph and set selectors etc) to reflect the current project state
GracePlot.write(command) Make a graceSession look like a file, and flush after send
GracePlot.xaxis(*args, **kwargs) Shortcut for sending the command to current graceGraph see below
GracePlot.xlabel(*args, **kwargs) Shortcut for sending the command to current graceGraph see below
GracePlot.xlimit(*args, **kwargs) Shortcut for sending the command to current graceGraph see below
GracePlot.yaxis(*args, **kwargs) Shortcut for sending the command to current graceGraph see below
GracePlot.ylabel(*args, **kwargs) Shortcut for sending the command to current graceGraph see below
GracePlot.ylimit(*args, **kwargs) Shortcut for sending the command to current graceGraph see below
GracePlot.aspect_scale(x, y) scale view coordinates to that (1,1) fills view, roughly
GracePlot.assign_color(idx, rgb, name) Assign color to an index including new colors.
GracePlot.close() Closes the plot
GracePlot.command_args
GracePlot.focus([graph_index, grace_graph]) Direct commands sent to the GracePlot to the appropriate GraceGraph.
GracePlot.grace_command
GracePlot.hold(*args, **kwargs) Shortcut for sending the command to current graceGraph see below
GracePlot.is_open() Return True if the pipe is not known to have been closed.
GracePlot.load_parameter_file(param_file_name) load a grace *.par file
GracePlot.new_graph(**kwargs) Add a new graph to plot.
GracePlot.redraw([force, soon]) Refresh the plot
GracePlot.resetlast() Resets last used symbols and lines.
GracePlot.resize(xdim, ydim) Change the page dimensions (in pixel)for plots with fixed size.
GracePlot.resolution resolution of the plot
GracePlot.send_commands(*commands) Send a list of commands, and then flush

11.2. GraceGraph

GraceGraph.autoscale([axis]) autoscales axes
GraceGraph.autotick()
GraceGraph.clear([slice, hold]) Clear plot
GraceGraph.frame([type, linestyle, …]) Set frame type of graph
GraceGraph.gen_axis(axis_prefix[, ax_min, …]) general axis handler
GraceGraph.grace()
GraceGraph.hold([onoff]) Turn on/off overplotting for this graph.
GraceGraph.kill() Kill the plot
GraceGraph.legend([strings, x, y, boxcolor, …]) Place the legend in the plot or update it.
GraceGraph.line([x1, y1, x2, y2, linewidth, …]) Draws line in plot
GraceGraph.plot(*datasets, **kwargs) Plot data in xmgrace
GraceGraph.redraw(*args, **kwargs) redraw Graph
GraceGraph.resetlast() Resets last used symbols and lines.
GraceGraph.subtitle([subtitle, font, size, …]) Sets the graph subtitle
GraceGraph.text([string, x, y, color, rot, …]) Writes text to graph at specified position.
GraceGraph.title([title, font, size, color]) Sets the graph title.
GraceGraph.update_data(set_index[, new_x, …]) Efficiently update the data for a given data set.
GraceGraph.xaxis([min, max]) Set axis properties
GraceGraph.xlabel(label[, charsize]) Convenience function to set the xaxis label charsize detemines charsize, default 1
GraceGraph.xlimit([lower, upper]) Convenience function to set the lower and/or upper bounds of the x-axis.
GraceGraph.yaxis([min, max]) Set axis properties
GraceGraph.ylabel(label[, charsize]) Convenience function to set the yaxis label
GraceGraph.ylimit([lower, upper]) Convenience function to set the lower and/or upper bounds of the y-axis.

11.3. Helper Classes

Annotation([onoff, type, charsize, font, …]) controls annotation
Bar([axis, onoff, color, linestyle, linewidth]) this class controls the x and y bars in the frame apparently usually it is off onoff is ‘on’ or ‘off’ the rest are like everything else
Data([x, y, symbol, line, legend, comment, …]) Simplest base class for all GracePlot data objects.
DataBar([x, y, symbol, line, legend, …])
DataXYBoxWhisker(x, y, whisker_down, …) A data set with a box for an asymmetrical inner error in the ‘y’ direction and an error bar (whisker) for the asymmetrical outer error bound.
DataXYDX(x, y, dx, **kwargs) A data set with symmetrical error bars in the ‘x’ direction
DataXYDXDX(x, y, dx_left, dx_right, **kwargs) A data set with asymmetrical error bars in the ‘x’ direction
DataXYDXDXDYDY(x, y, dx_left, dx_right, …) A data set with asymmetrical error bars in the ‘x’ and ‘y’ direction
DataXYDXDY(x, y, dx, dy, **kwargs) A data set with symmetrical error bars in the ‘x’ and ‘y’ direction
DataXYDY(x, y, dy, **kwargs) A data set with symmetrical error bars in the ‘y’ direction
DataXYDYDY(x, y, dy_down, dy_up, **kwargs) A data set with asymmetrical error bars in the ‘y’ direction
DataXYZ(x, y, z, **kwargs)
Errorbar([onoff, place, color, pattern, …]) class for errorbars
Label([string, layout, place, charsize, …]) Used for labels of the x-axis and y-axis
Line([type, linestyle, linewidth, color, …]) Line objekt
Symbol([type, symbol, size, color, pattern, …]) Symbol object
Tick([axis, onoff, major, minorticks, …]) Controls appearence of ticks on an axis.
TickLabel([axis, onoff, type, prec, format, …]) Ticklabels
colors
fills
frames
lines
symbols
Disconnected Thrown when xmgrace unexpectedly disconnects from the pipe.
format_scientific(val) format x.xxxe+-yy as a typeset grace string
inheritDocstringFrom(cls)
on_off(flag) convert a bool into an xmgrace on/off string

A high-level Python interface to the Grace plotting package XmGrace

  • one line command plotting: plot of numpy arrays and dataArrays without predefining Data or Symbol objects.
  • symbol, line and error are defined by list arguments as line=[1,0.5,3]
  • Older functionality still works and can be used for more sophisticated output.

Example

import jscatter as js
data=js.dL('exampleData/iqt_1hho.dat')               #read data from test directory into dataList
p=js.grace(3,2)                      #make plot with size 2,3
# symbol=[-1,0.3,-1]  -> increment symbols,size 0.3, increment colors
# line  =[1,1,'']     -> line type 1, line thickness 1, sync colors to symbol
# legend='Q=$q'  takes the value of the parameter q from the data like in shell substitution
#
p.plot(data,symbol=-1,line=[1,1,''],legend='Q=$q')
#
# finetuning only if needed
# make axes, legend, title, and subtitle to get nice plot
p.yaxis(min=0.09,max=1.1,scale='l',label='I(Q,t)/I(Q,0)',charsize=1.50)
p.xaxis(min=0.0,max=250,label='fouriertime t / ns ',charsize=1.50)
p.legend(x=190,y=1)
p.title('An example for the intermediate scattering function in \n Neutron Spinecho Spectroscopy',size=1)
p.subtitle('colors of lines are sync to symbol color')
# add a text
p.text('Here we place a text just as demo\n at the last point of this dataset',x=90,y=0.18,charsize=1)
p.save('testdata.agr') #as grace file
p.save('testdata',format='jpeg') #as jpg file

Originally, this code of GracePlot started out from: Nathaniel Gray <n8gray@caltech.edu>, updated by Marcus H. Mendenhall, MHM ,John Kitchin, Marus Mendenhall

  • original source -> sourceforge.net/projects/graceplot/ 2014 and according to that site: License: GNU General Public License version 2.0 (GPLv2)
  • Consequently this file is still under GNU General Public License version 2.0 (GPLv2)

Ralf Biehl JCNS1 & ICS1 Forschungszentrum Juelich 2014

Resources
class jscatter.graceplot.Annotation(onoff=True, type=None, charsize=None, font=None, color=None, rot=None, format=None, prec=None, prepend=None, append=None, offset=None)[source]

controls annotation

Parameters:
onoff : ‘on’ or ‘off’
type : int
charsize : float
font : int
color : int
rot : float
format : int
prec : int
prepend : int
append : int
offset : int
output(dataset)[source]

list output to sent to grace

class jscatter.graceplot.Bar(axis=None, onoff=True, color=None, linestyle=None, linewidth=None)[source]

this class controls the x and y bars in the frame apparently usually it is off onoff is ‘on’ or ‘off’ the rest are like everything else

output(axis)[source]

list output to sent to grace

class jscatter.graceplot.Data(x=None, y=None, symbol=None, line=None, legend='', comment=None, errorbar=None, pairs=None, dylist=None, **kwargs)[source]

Simplest base class for all GracePlot data objects.

dataset_type_name = 'xy'
output(graceGraph, count)[source]

No checking is done to make sure the datasets are consistent with each other, same number of x and y etc… Support of None values is only in the xy graph.

output_differences(graceGraph, count, new_x, new_y, new_dylist)[source]

output strings to modify already created datasets, issuing results only for changed items

x_format_string = '%s'
y_format_string = '%s'
class jscatter.graceplot.DataBar(x=None, y=None, symbol=None, line=None, legend='', comment=None, errorbar=None, pairs=None, dylist=None, **kwargs)[source]

Bases: jscatter.graceplot.Data

dataset_type_name = 'bar'
class jscatter.graceplot.DataXYBoxWhisker(x, y, whisker_down, box_down, whisker_up, box_up, **kwargs)[source]

Bases: jscatter.graceplot.Data

A data set with a box for an asymmetrical inner error in the ‘y’ direction and an error bar (whisker) for the asymmetrical outer error bound. The symbol properties set the color (etc.) of the box. The errorbar properties set the color (etc.) of the whisker

dataset_type_name = 'xyboxplot'
class jscatter.graceplot.DataXYDX(x, y, dx, **kwargs)[source]

Bases: jscatter.graceplot.Data

A data set with symmetrical error bars in the ‘x’ direction

dataset_type_name = 'xydx'
class jscatter.graceplot.DataXYDXDX(x, y, dx_left, dx_right, **kwargs)[source]

Bases: jscatter.graceplot.Data

A data set with asymmetrical error bars in the ‘x’ direction

dataset_type_name = 'xydxdx'
class jscatter.graceplot.DataXYDXDXDYDY(x, y, dx_left, dx_right, dy_down, dy_up, **kwargs)[source]

Bases: jscatter.graceplot.Data

A data set with asymmetrical error bars in the ‘x’ and ‘y’ direction

dataset_type_name = 'xydxdxdydy'
class jscatter.graceplot.DataXYDXDY(x, y, dx, dy, **kwargs)[source]

Bases: jscatter.graceplot.Data

A data set with symmetrical error bars in the ‘x’ and ‘y’ direction

dataset_type_name = 'xydxdy'
class jscatter.graceplot.DataXYDY(x, y, dy, **kwargs)[source]

Bases: jscatter.graceplot.Data

A data set with symmetrical error bars in the ‘y’ direction

dataset_type_name = 'xydy'
class jscatter.graceplot.DataXYDYDY(x, y, dy_down, dy_up, **kwargs)[source]

Bases: jscatter.graceplot.Data

A data set with asymmetrical error bars in the ‘y’ direction

dataset_type_name = 'xydydy'
class jscatter.graceplot.DataXYZ(x, y, z, **kwargs)[source]

Bases: jscatter.graceplot.Data

dataset_type_name = 'xyz'
exception jscatter.graceplot.Disconnected[source]

Bases: exceptions.Exception

Thrown when xmgrace unexpectedly disconnects from the pipe.

This exception is thrown on an EPIPE error, which indicates that xmgrace has stopped reading the pipe that is used to communicate with it. This could be because it has been closed (e.g., by clicking on the exit button), crashed, or sent an exit command.

class jscatter.graceplot.Errorbar(onoff=True, place=None, color=None, pattern=None, size=None, linewidth=None, linestyle=None, riserlinewidth=None, riserlinestyle=None, riserclip=None, risercliplength=None)[source]

class for errorbars

Parameters:
onoff : True False,’on’,’off’, default on

turns the error bars on or off

place : ‘normal’, ‘opposite’, ‘both’ default ‘both’
color : int

color integer

pattern : int
linewidth : float
linestyle : int
riserlinewidth : float

risers are the lines from the symbol to the end

riserlinestyle : int
riserclip : ‘on’,’off’

set to on or off, determines if an arrow is drawn for error bars offscale

risercliplength : float
output(symbol)[source]

list output to sent to grace

class jscatter.graceplot.GraceGraph(grace, gID, xmin=0.15, xmax=0.95, ymin=0.15, ymax=0.9)[source]

class for handling GraceGraph

Parameters:
gID : integer

Graph ID

xmin,xmax,ymin,ymax : float default 0.15,0.95,0.15,0.88

position of edges in plot in relative view coordinates

SetView(xmin=None, ymin=None, xmax=None, ymax=None, aspect_scaled=True)[source]

this sets the viewport coords so they are available later for translating string and line coords.

Parameters:
xmin,xmax,ymin,ymax : float

view range

aspect_scaled : bool

aspect

autoscale(axis=None)[source]

autoscales axes

axis : ‘x’,’y’,None
None, scale all axes, otherwise if it is ‘x’ or ‘y’ scale that axis
autotick()[source]
clear(slice=slice(None, None, None), hold=0)[source]

Clear plot

Parameters:
slice : slice

Selects elements to delete. If ommited clear all. e.g. last for elements slice=slice(-4) Dont use slice extensivly as it could mess up.

hold : bool, default 0

Set/reset to hold lines.

frame(type=None, linestyle=None, linewidth=None, color=None, pattern=None, backgroundcolor=None, backgroundpattern=None)[source]

Set frame type of graph

Parameters:
type : [0,1,2,3,4,5] => closed,halfopen,breaktop,breakbottom,breakleft,breakright

Boxtype

linestyle : int

Linestyle; see plot

linewidth : float

linewidth; see plot

color : int; see plot

Color

pattern : int

Pattern

backgroundcolor : int

Color

backgroundpattern : int

Pattern

Notes

For the different types except of close the axis bar and tick marks need to be removed

gen_axis(axis_prefix, ax_min=None, ax_max=None, scale=None, invert=None, formula=None, offset=None, label=None, ticklabel=None, charsize=None, size=None, tick=None, bar=None, autotick=True)[source]

general axis handler

Parameters:
axis_prefix : {‘x’,’y’}

determines axis

ax_min,ax_max : float

min and max of axis

scale : {‘normal’, ‘logarithmic’, or ‘reciprocal’ or respectivly ‘n’,’l’,’r’}

sets type of axis

label : string, list or Label object

Label of the axis; see Label object. If string this is the label string. If list it determines [labelstring,charsize,place,color] place : ‘normal’,’both’,’opposite’

invert : {True,False}

invert axis

formula : grace equation

formula for ticklabel calculation eg. rescaling $t is label -> scaling as $t*1e5

charsize,size : float

determines character size, default 1

offset : list of float

determines the position of the normal and opposite axis position

autotick : bool

autoticking

tick : Tick object or list, False, True

list of [major tick distance , minorticks number,majorsize,minorsize,position] position as one of ‘normal’,’both’,’opposite’ (first letter is enough) False, True switch Ticks on and off see Tick for more

ticklabel : float, list, tickLabel object

With [format,precision,charsize,placeon] or only charsize format: ‘decimal’,’exponential’,’general’,’power’,’scientific’ precision : integer placeon : ‘normal’,’both’,’opposite’

bar : ‘on’,’off’,list or bar object

see bar object on off switch on or off list=[onoff,color,linestyle,linewidth]

grace()[source]
hold(onoff=None)[source]

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()[source]

Kill the plot

legend(strings=None, x=None, y=None, boxcolor=None, boxpattern=None, boxlinewidth=None, boxlinestyle=None, boxfillcolor=None, boxfillpattern=None, font=None, charsize=None, color=None, length=None, vgap=None, hgap=None, invert=None, world_coords=True, offset=0, onoff=True)[source]

Place the legend in the plot or update it.

Parameters:
strings : list of strings,string, default=None

List of legend strings or one string. If None then self.legend_strings is used. self.legend_strings is build from legend attribut in plot

offset : int, default 0

Which legend string to change if strings is single string >0 with offset shifted =<0 starting from last reverse order default 0 names last legend

x,y: float

Position of the upper left corner of the box in data coordinates

boxcolor : int

Color of the legend box lines

boxpattern : integer

Pattern of the legend box lines

boxlinewidth : float

Thickness of the line

boxlinestyle,boxfillcolor,boxfillpattern : integer

As name says

font : int

Is the font used in the legend

charsize : float

Size of the characters

length : int

Length of the box must be an integer

vgap : int

Vertical space between entries, can be a float

hgap : float

Horizontal spacing in the box can be a float

invert : bool, (True,False)

Order of entries, either in the order they are entered, or the opposite

onoff : bool

Show legend or not

line(x1=None, y1=None, x2=None, y2=None, linewidth=None, linestyle=None, color=None, arrow=None, arrowtype=None, arrowlength=None, arrowlayout=None, world_coords=True)[source]

Draws line in plot

Coordinates are the cartesian cooridinates for a single graph.

x1,y1,x2,y2 : float
Start and end point
linewidth : float
Width
linestyle : int
Style
color : int
Color
arrow
Tells where the arrowhead is and is 0,1,2, or 3 for none, start, end, both ends
arrowtype
Is for line (0), filled (1), or opaque (2), and only have an effect if the arrowlayout is not (1,1)
arrowlayout
Must be a list of 2 numbers, arrowlayout=(1,1) the first number relates to d/L and the second is I/L the meaning of which is unclear, but they affect the arrow shape.
plot(*datasets, **kwargs)[source]

Plot data in xmgrace

e.g. p.plot(data,legend=’description’,symbol=[1,0.5,4],line=[1,2,2],errorbar=[0])

Parameters:
datasets : dataArray, dataList,numpy array, lists of them

Several of (comma separated) nonkeyword arguments or as list. If dimension of datasets is one a new Data object is created and plotted see Notes below for error plots.

symbol,sy : int, list of float or Symbol object
  • [symbol,size,color,fillcolor,fillpattern] as [1,1,1,-1];
  • single integer to chose symbol eg symbol=3; symbol=0 switches off
  • negative increments from last, non integer repeat last
  • symbol => 0-11 = ◦,☐,♢,▵,◁,▽,▷,+,×,☆,(11 is char)
  • size => size, a number eg 0.5
  • color => int 0-16 = white,black,red,green,blue,ligth green,brown,
    darkgrey,violet,orange,magenta,grey
  • fillcolor=None set color and adds fillpattern=1,
    non-integer syncs to symbol color
  • fillpattern=None 0 empty, 1 full, ….test it
line,li : int, list of float or Line object
  • [linestyle,linewidth,color] as [1,1,’‘];
  • negative increments;non integer as ‘’ repeats last
  • single integer to chose line line=1; line=0 switches of
  • linestyle int 1 normal, 2 dotted, 3 dashed, 4 long dashed, 5 dot-dashed
  • linewidth float goes from 0 to 6 in increasing thickness
  • color see symbol color, non-integer syncs to symbol color
errorbar,er : int or list of float or Errorbar object
  • [color,size,linewidth,riserlinewidth] as [1,1,1,1]; no increment, no repeat
  • color int see symbol color, non-integer syncs to symbol color
  • size float default 1.0 ; smaller is 0.5
  • linewidth float default 1.0
  • riserlinewidth float default 1.0
legend,le : string
  • determines legend for all datasets
  • string replacement: attr name prepended by ‘$’ (eg. ‘$par’) is replaced by value str(par1.flatten()[0]) if possible. $(par) for not unique names
comment: string
  • string determines comment for all datasets
  • for dataArray: list of attribute values is set as comment to ckeck use dataArray.resumeAttrTxt()
autoscale : bool

default True, False

internal_autoscale : bool

default True, False 10% border

redraw : bool

redraw

Notes

Plot types determined by dimension of dataset

  • 1: dataset is type Data instances
    See Data class for possibilities and original documentation.
  • 2: dataset is numpy array; simplified version
    Use slices like data_in_numpyarray[[0,3,2],:] to select columns to plot
    • len(array)= 2 XY
    • len(array)= 3 XYDY
    • len(array)= 4 XYDXDY
  • 3: dataset is dataArray ; simplified version
    • attributes X,Y,eY,eX determine plot type if they exist. So set these before plot by dataset.setColumnIndex(3,4,7)
    • default is 0,1,2 for X,Y,eY, No eX
    • Slicing works too as for arrays.

For more complex plots use original Data class in 1. Old style plotting needs creation of GracePlot.Data objects like

d1=Data(x=x,y=y,symbol=GracePlot.Symbol(symbol=circle,fillcolor=red),line=GracePlot.Line(type=none))
or in short abreviation:
d1=Data(x=x,y=y,symbol=[-1,2,3,4],line=[1,2,3])
#plotted sets can be accessed by
p[0].datasets   as a list of Data objects

Examples

tX =np.r_[0:10]
tY=np.sin(tX)
data=np.c_[tX,tY,tY*0.05].T
p=s.grace()                    # open plot
# plot single column data tX,tY,teY
p.plot(tX,tY,legend='all 1D data',symbol=3,line=1,errorbar=[0])
#plot Data with arrray or dataList
p.plot(data,legend='description',symbol=[1,0.5,4],line=[1,2,2],errorbar=[0])
p.yaxis(label='whatever / m')  # change y label
p.legend()                     # show legends
redraw(*args, **kwargs)[source]

redraw Graph

pass through to our GraceGraph instance

resetlast()[source]

Resets last used symbols and lines.

lastline=[1,0,0] lastsymbol=[1,0.5,1,0] lasterror=[0,0,0,0]

shiftbyfactor(xy=None, factor=None, repeat=None, scale='lin', xfactors=None, yfactors=None)[source]

Shift data consecutively by factors

Consecutively multiply by 2 as 2,4,6,8…. or with power laws.

Parameters:
xy : ‘xy’

Selector for x or y axis or both

factor : float

Shift factor

repeat : float default=number of sets in plot

Repeat number of times the factor 3 -> 2,4,6,2,4,6… for factor=2

xfactors : array or list

Factors as list, overrides factor and repeat

yfactors : array or list

Factors as list,overrides factor and repeat dylist is also shifted

scale : ‘log’, other

If ‘log’ a factor**i is used for logarithmic scale all other factor*i is used

Notes

List is

factor*np.tile(np.r_[1:repeat+1],nSets)  lin scale
factor**np.tile(np.r_[1:repeat+1],nSets)  log scale

Create factors manually e.g. by

np.tile([1,2,3],3)         -->  array([1, 2, 3, 1, 2, 3, 1, 2, 3])
1.1**np.tile([1,1,2],3)    -->  array([1.1, 1.1, 1.21, 1.1, 1.1, 1.21, 1.1, 1.1, 1.21])
#for an inverse shifting
2*np.tile(np.r_[10:1:-1],3)-->  array([20, 18, 16, 14, 12, 10,  8,  6,  4, 20, 18, 16, 14, 12, 10,  8,  6, 4])
subtitle(subtitle=None, font=None, size=None, color=None)[source]

Sets the graph subtitle

see title

text(string=None, x=None, y=None, color=None, rot=None, font=None, just=None, charsize=None, world_coords=True)[source]

Writes text to graph at specified position.

Parameters:
string : string

Text to print

x,y: float

Coordinates are the cartesian coordinates of x,y axis

color : int

Color

rot : float

Rotation angle

font : int

Font as defined in default xmgrace plot

just

Justification

charsize : float

Charsize

world_coords : bool

World coordinates or viewport coordinates

Notes

Try in Gui for values.

title(title=None, font=None, size=None, color=None)[source]

Sets the graph title.

Parameters:
title : string

Title string

font

Font of title

size : float

Size of title

color : integer

Color of title

update_data(set_index, new_x=None, new_y=None, new_dylist=None)[source]

Efficiently update the data for a given data set. set length, etc. must not change!

xaxis(min=None, max=None, **kwargs)[source]

Set axis properties

Parameters:
min : float

Minimum axis value

max : float

Maximum axis value

scale : {‘normal’, ‘logarithmic’, or ‘reciprocal’ or respectively ‘n’,’l’,’r’}

Sets type of axis

label : string or Label object

Label of the axis; see Label object. If string this is the label string. If list it determines [labelstring,charsize,place,color] place : ‘normal’,’both’,’opposite’

invert : {True,False}

Invert axis

formula : grace equation

Formula for ticklabel calculation eg. rescaling $t is label -> ‘$t*1e5’

charsize,size : float

Determines size, default 1

offset : list of float

Determines the position of the normal and opposite axis position

autotick : bool

Autoticking

tick : Tick object or list, False True

List of [major tick distance , minorticks number,majorsize,minorsize,position] position: ‘normal’,’both’,’opposite’ (first letter is enough) False/True switch Ticks on and off see Tick for more

ticklabel : float, list, tickLabel object

With [format,precision,charsize,placeon] or only charsize format: ‘decimal’,’exponential’,’general’,’power’,’scientific’ precision: integer placeon: ‘normal’,’both’,’opposite’

bar : list or bar object

See bar object list=[onoff,color,linestyle,linewidth]

xlabel(label, charsize=None)[source]

Convenience function to set the xaxis label charsize detemines charsize, default 1

xlimit(lower=None, upper=None)[source]

Convenience function to set the lower and/or upper bounds of the x-axis.

yaxis(min=None, max=None, **kwargs)[source]

Set axis properties

Parameters:
min : float

Minimum axis value

max : float

Maximum axis value

scale : {‘normal’, ‘logarithmic’, or ‘reciprocal’ or respectivly ‘n’,’l’,’r’}

Sets type of axis

label : string or Label object

Label of the axis; see Label object. If string this is the label string. If list it determines [labelstring,charsize,place,color] place : ‘normal’,’both’,’opposite’

invert : {True,False}

Invert axis

formula : grace equation

Formula for ticklabel calculation eg. rescaling $t is label -> scaling as $t*1e5

charsize : float

Determines size, default 1

offset : list of float

Determines the position of the normal and opposite axis position

autotick : bool

Autoticking

tick : Tick object or list, False True

List of [major tick distance , minorticks number,majorsize,minorsize,position] position as one of ‘normal’,’both’,’opposite’ (first letter is enough) False True switch Ticks on and off see Tick for more

ticklabel : float, list, tickLabel object

With [format,precision,charsize,placeon] or only charsize format: ‘decimal’,’exponential’,’general’,’power’,’scientific’ precision : integer placeon : ‘normal’,’both’,’opposite’

bar : list or bar object

See bar object list=[onoff,color,linestyle,linewidth]

ylabel(label, charsize=None)[source]

Convenience function to set the yaxis label

ylimit(lower=None, upper=None)[source]

Convenience function to set the lower and/or upper bounds of the y-axis.

class jscatter.graceplot.GracePlot(width=None, height=None, auto_redraw=True, redraw_interval=0.1)[source]

Create a GracePlot object, which manages an external grace instance. The instance may have multiple GraceGraph objects within it. Commands which are specific to a graph (such as plotting data) are sent to the graph object. Commanbds which are global (such as redraw control) are sent to the GracePlot object.

width*resolution=width in pixels, same for height. Resolution is set to 300 by default, so width is roughly inches on an 300 dpi monitor. By changing the class default resolution, you can change the units of width & height.

if auto_redraw is True, the graph will automatically hold off redrawing until data stops being sent for a time of redraw_interval (seconds).

To force an immediate redraw, call GracePlot.redraw(force=True). Calling GracePlot.redraw() without an argument schedules a redraw at the next quiet interval. This mechanism greatly reduces thrashing of grace windows by repeated un-needed redraws.

To force a redraw on the next cycle of the redrawing thread, call GracePlot.redraw(soon=True). This will cause a redraw even if there is still data flowing, but not in a hurry.

The GracePlot class does all its data transmission through a thread, so usually there should be no significant time during which the calling thread is blocked. This should improve real-time performance.

SetView(*args, **kwargs)[source]

Shortcut for sending the command directly to the appropriate graceGraph object see below

this sets the viewport coords so they are available later for translating string and line coords.

Parameters:
xmin,xmax,ymin,ymax : float

view range

aspect_scaled : bool

aspect

aspect_scale(x, y)[source]

scale view coordinates to that (1,1) fills view, roughly

assign_color(idx, rgb, name)[source]

Assign color to an index including new colors.

Parameters:
idx : int (0..16..)

Index of color.

rgb : set of integer (0..255)

RGB color as (0,0,0)

name : string

New name of color.

Notes

If used indices are changed the corresponding elements using this are changed too. This means changing index 1 (usually black) used for the axes changes axes color.

More can be used.

Examples

Set color 4 to (0, 0, 255) as blue

assign_color(4, (0,0,255), 'blue')

Append a list of new colors and use them in plot

x=np.r_[1:10]
p=js.grace()
p.colors.list    # shows actual color list
NN=40
clist=np.c_[np.r_[1:NN+1],np.r_[255:0:NN*1j].round(),np.r_[255:0:NN*1j].round(),np.r_[0:255:NN*1j].round()]
for i,r,g,b in clist:
   p.assign_color(i+15,(r,g,b),'test%.2g' %i)
for i in np.r_[1:p.colors.len]:
   p.plot(x,x+i,sy=[1,0.7,p.colors.len-i],li=[1,5,i])

reassign colors

clist=np.c_[np.r_[1:NN+1],np.r_[0:255:NN*1j].round(),np.r_[255:0:NN*1j].round(),np.r_[0:255:NN*1j].round()]
for i,r,g,b in clist:
   p.assign_color(i+15,(r,g,b),'test%.2g' %i)

reassign colors grey scale:

clist=np.c_[np.r_[1:NN+1],np.r_[0:255:NN*1j].round(),np.r_[0:255:NN*1j].round(),np.r_[0:255:NN*1j].round()]
for i,r,g,b in clist:
   p.assign_color(i+15,(r,g,b),'test%.2g' %i)
clear(*args, **kwargs)[source]

Shortcut for sending the command to current graceGraph see below

Clear plot

Parameters:
slice : slice

Selects elements to delete. If ommited clear all. e.g. last for elements slice=slice(-4) Dont use slice extensivly as it could mess up.

hold : bool, default 0

Set/reset to hold lines.

close()[source]

Closes the plot

command_args = ('-nosafe', '-noask')
exit()[source]

Nuke the grace session.

focus(graph_index=None, grace_graph=None)[source]

Direct commands sent to the GracePlot to the appropriate GraceGraph.

Mostly for backwards compatibility. It is preferable to send the commands directly to the plot:

p[2].plot(....)
grace_command = 'xmgrace'
hold(*args, **kwargs)[source]

Shortcut for sending the command to current graceGraph see below

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.

is_open()[source]

Return True if the pipe is not known to have been closed.

legend(*args, **kwargs)[source]

Shortcut for sending the command to current graceGraph

Place the legend in the plot or update it.

Parameters:
strings : list of strings,string, default=None

List of legend strings or one string. If None then self.legend_strings is used. self.legend_strings is build from legend attribut in plot

offset : int, default 0

Which legend string to change if strings is single string >0 with offset shifted =<0 starting from last reverse order default 0 names last legend

x,y: float

Position of the upper left corner of the box in data coordinates

boxcolor : int

Color of the legend box lines

boxpattern : integer

Pattern of the legend box lines

boxlinewidth : float

Thickness of the line

boxlinestyle,boxfillcolor,boxfillpattern : integer

As name says

font : int

Is the font used in the legend

charsize : float

Size of the characters

length : int

Length of the box must be an integer

vgap : int

Vertical space between entries, can be a float

hgap : float

Horizontal spacing in the box can be a float

invert : bool, (True,False)

Order of entries, either in the order they are entered, or the opposite

onoff : bool

Show legend or not

load_parameter_file(param_file_name)[source]

load a grace *.par file

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

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

Arrange existing graphs (or add extra if needed) to form an nrows by ncols matrix, leaving offset at each page edge with hgap and vgap relative horizontal and vertical spacings

Parameters:
rows,cols : integer

Number of graphs

offset : float

Offset from edges

hgap,vgap : float

Horizontal, vertical gap between plots

Notes

Overmuch graphs are deleted

new_graph(**kwargs)[source]

Add a new graph to plot.

Parameters:
xmin,xmax,ymin,ymax : float; default 0.15,0.95,0.15,0.88

Position of edges in plot in relative view coordinates

plot(*args, **kwargs)[source]

Shortcut for sending the command directly to the appropriate graceGraph object see below

Plot data in xmgrace

e.g. p.plot(data,legend=’description’,symbol=[1,0.5,4],line=[1,2,2],errorbar=[0])

Parameters:
datasets : dataArray, dataList,numpy array, lists of them

Several of (comma separated) nonkeyword arguments or as list. If dimension of datasets is one a new Data object is created and plotted see Notes below for error plots.

symbol,sy : int, list of float or Symbol object
  • [symbol,size,color,fillcolor,fillpattern] as [1,1,1,-1];
  • single integer to chose symbol eg symbol=3; symbol=0 switches off
  • negative increments from last, non integer repeat last
  • symbol => 0-11 = ◦,☐,♢,▵,◁,▽,▷,+,×,☆,(11 is char)
  • size => size, a number eg 0.5
  • color => int 0-16 = white,black,red,green,blue,ligth green,brown,
    darkgrey,violet,orange,magenta,grey
  • fillcolor=None set color and adds fillpattern=1,
    non-integer syncs to symbol color
  • fillpattern=None 0 empty, 1 full, ….test it
line,li : int, list of float or Line object
  • [linestyle,linewidth,color] as [1,1,’‘];
  • negative increments;non integer as ‘’ repeats last
  • single integer to chose line line=1; line=0 switches of
  • linestyle int 1 normal, 2 dotted, 3 dashed, 4 long dashed, 5 dot-dashed
  • linewidth float goes from 0 to 6 in increasing thickness
  • color see symbol color, non-integer syncs to symbol color
errorbar,er : int or list of float or Errorbar object
  • [color,size,linewidth,riserlinewidth] as [1,1,1,1]; no increment, no repeat
  • color int see symbol color, non-integer syncs to symbol color
  • size float default 1.0 ; smaller is 0.5
  • linewidth float default 1.0
  • riserlinewidth float default 1.0
legend,le : string
  • determines legend for all datasets
  • string replacement: attr name prepended by ‘$’ (eg. ‘$par’) is replaced by value str(par1.flatten()[0]) if possible. $(par) for not unique names
comment: string
  • string determines comment for all datasets
  • for dataArray: list of attribute values is set as comment to ckeck use dataArray.resumeAttrTxt()
autoscale : bool

default True, False

internal_autoscale : bool

default True, False 10% border

redraw : bool

redraw

Notes

Plot types determined by dimension of dataset

  • 1: dataset is type Data instances
    See Data class for possibilities and original documentation.
  • 2: dataset is numpy array; simplified version
    Use slices like data_in_numpyarray[[0,3,2],:] to select columns to plot
    • len(array)= 2 XY
    • len(array)= 3 XYDY
    • len(array)= 4 XYDXDY
  • 3: dataset is dataArray ; simplified version
    • attributes X,Y,eY,eX determine plot type if they exist. So set these before plot by dataset.setColumnIndex(3,4,7)
    • default is 0,1,2 for X,Y,eY, No eX
    • Slicing works too as for arrays.

For more complex plots use original Data class in 1. Old style plotting needs creation of GracePlot.Data objects like

d1=Data(x=x,y=y,symbol=GracePlot.Symbol(symbol=circle,fillcolor=red),line=GracePlot.Line(type=none))
or in short abreviation:
d1=Data(x=x,y=y,symbol=[-1,2,3,4],line=[1,2,3])
#plotted sets can be accessed by
p[0].datasets   as a list of Data objects

Examples

tX =np.r_[0:10]
tY=np.sin(tX)
data=np.c_[tX,tY,tY*0.05].T
p=s.grace()                    # open plot
# plot single column data tX,tY,teY
p.plot(tX,tY,legend='all 1D data',symbol=3,line=1,errorbar=[0])
#plot Data with arrray or dataList
p.plot(data,legend='description',symbol=[1,0.5,4],line=[1,2,2],errorbar=[0])
p.yaxis(label='whatever / m')  # change y label
p.legend()                     # show legends
redraw(force=False, soon=False)[source]

Refresh the plot

resetlast()[source]

Resets last used symbols and lines.

lastline=[1,0,0] lastsymbol=[1,0.5,1,0] lasterror=[0,0,0,0]

resize(xdim, ydim)[source]

Change the page dimensions (in pixel)for plots with fixed size.

Parameters:
xdim, ydim : int

dimension in pixel

resolution = 300

resolution of the plot

save(filename, size=(1012, 760), dpi=300, format='agr')[source]

Save the current plot

Parameters:
filename : string

If filename has extension this is used instead of format.

size : tuple 2 x integer

Size in dots. For PRL and other papers: Figures should be planned for the column width (8.6 cm or 3 3/8 in.)

  • 506 pixel 150 dpi (ok in powerpoint as png )
  • 1012 pixel 300 dpi (default)
  • 2024 pixel 600 dpi (paper ready quality e.g as eps)
dpi : in
resolution in dots per inch (2.54 cm)

format : string x11, postscript, eps, pdf, mif, svg, pnm, jpeg, png, metafile

format : Default is Grace ‘.agr’ file

‘agr’, ‘eps’, ‘jpeg’, ‘metafile’, ‘mif’, ‘pdf’, ‘png’, ‘pnm’, ‘postscript’, ‘svg’, ‘x11’

Notes

Not all drivers are created equal. For caveats that apply to some of these formats see the Grace documentation.

send_commands(*commands)[source]

Send a list of commands, and then flush

Parameters:
commands : list of strings
shiftbyfactor(*args, **kwargs)[source]

Shortcut for sending the command directly to the appropriate graceGraph object see below

Shift data consecutively by factors

Consecutively multiply by 2 as 2,4,6,8…. or with power laws.

Parameters:
xy : ‘xy’

Selector for x or y axis or both

factor : float

Shift factor

repeat : float default=number of sets in plot

Repeat number of times the factor 3 -> 2,4,6,2,4,6… for factor=2

xfactors : array or list

Factors as list, overrides factor and repeat

yfactors : array or list

Factors as list,overrides factor and repeat dylist is also shifted

scale : ‘log’, other

If ‘log’ a factor**i is used for logarithmic scale all other factor*i is used

Notes

List is

factor*np.tile(np.r_[1:repeat+1],nSets)  lin scale
factor**np.tile(np.r_[1:repeat+1],nSets)  log scale

Create factors manually e.g. by

np.tile([1,2,3],3)         -->  array([1, 2, 3, 1, 2, 3, 1, 2, 3])
1.1**np.tile([1,1,2],3)    -->  array([1.1, 1.1, 1.21, 1.1, 1.1, 1.21, 1.1, 1.1, 1.21])
#for an inverse shifting
2*np.tile(np.r_[10:1:-1],3)-->  array([20, 18, 16, 14, 12, 10,  8,  6,  4, 20, 18, 16, 14, 12, 10,  8,  6, 4])
stacked(number, hshift, vshift, frame=None, yaxis='off', yaxisnumber=0, frametype=0, framepattern=1)[source]

Creates a stacked chart with shifted graphs in the frame

Already exsiting graphs are reused, fineadjustement needs to be done by hand.

Parameters:
number : int

Number of graphs

hshift : float

Horizontal shift in viewport coords

vshift : float

Vertikal shift in viewport coords

yaxis : ‘normal’,’opposite’,’both’,default ‘off’

Where to place the yaxis

framepattern : int

Frame pattern type; 1 is No frame

frame : [float,float,float,float], default [0.15,0.15,0.9,0.9]

Frame size in viewport coordinates [0..1]

yaxisnumber : int

Framenumber where to place yaxis

frametype : int

Frametype 0=closed,1=halfopen,2,3,4,5= break at top,bottom,left,right

framepattern

0= None, 1=full,…..and so on

Examples

p.stacked(10,hshift=0.02,vshift=0.01,yaxis='off')
p.stacked(10,hshift=-0.015,vshift=-0.01,yaxis='off')
#create a stacked chart of 10 plots
# each shifted by hshift,vshift
#the yaxis is switched off for all except the first
x=np.r_[0:5:100j]
p=js.grace()
p.stacked(10,hshift=0.02,vshift=0.01,yaxis='off')
#plot some Gaussians
for i in range(10):p[i].plot(x,(i+1)*np.exp(-((x-2)*3)**2),li=[1,2,i+1],sy=0)
#choose the same yscale for the data but no ticks for the later plots
p.g[0].yaxis(min=0,max=10)
for pp in p.g[1:]:pp.yaxis(min=0,max=10,tick=False)
#adjusting the scale and the size of the xaxis ticks
for pp in p:pp.xaxis(tick=[1,1,0.3,0.1])
p[0].yaxis(tick=[1,1,0.3,0.1])
subtitle(*args, **kwargs)[source]

Shortcut for sending the command to current graceGraph see below

Sets the graph subtitle

see title

text(*args, **kwargs)[source]

Writes text to graph at specified position.

Parameters:
string : string

Text to print

x,y: float

Coordinates are the cartesian coordinates of x,y axis

color : int

Color

rot : float

Rotation angle

font : int

Font as defined in default xmgrace plot

just

Justification

charsize : float

Charsize

world_coords : bool

World coordinates or viewport coordinates

Notes

Try in Gui for values.

title(*args, **kwargs)[source]

Shortcut for sending the command to current graceGraph see below

Sets the graph title.

Parameters:
title : string

Title string

font

Font of title

size : float

Size of title

color : integer

Color of title

updateall()[source]

Update the GUI (graph and set selectors etc) to reflect the current project state

write(command)[source]

Make a graceSession look like a file, and flush after send

xaxis(*args, **kwargs)[source]

Shortcut for sending the command to current graceGraph see below

Set axis properties

Parameters:
min : float

Minimum axis value

max : float

Maximum axis value

scale : {‘normal’, ‘logarithmic’, or ‘reciprocal’ or respectively ‘n’,’l’,’r’}

Sets type of axis

label : string or Label object

Label of the axis; see Label object. If string this is the label string. If list it determines [labelstring,charsize,place,color] place : ‘normal’,’both’,’opposite’

invert : {True,False}

Invert axis

formula : grace equation

Formula for ticklabel calculation eg. rescaling $t is label -> ‘$t*1e5’

charsize,size : float

Determines size, default 1

offset : list of float

Determines the position of the normal and opposite axis position

autotick : bool

Autoticking

tick : Tick object or list, False True

List of [major tick distance , minorticks number,majorsize,minorsize,position] position: ‘normal’,’both’,’opposite’ (first letter is enough) False/True switch Ticks on and off see Tick for more

ticklabel : float, list, tickLabel object

With [format,precision,charsize,placeon] or only charsize format: ‘decimal’,’exponential’,’general’,’power’,’scientific’ precision: integer placeon: ‘normal’,’both’,’opposite’

bar : list or bar object

See bar object list=[onoff,color,linestyle,linewidth]

xlabel(*args, **kwargs)[source]
Shortcut for sending the command to current graceGraph
see below
Convenience function to set the xaxis label
charsize detemines charsize, default 1
xlimit(*args, **kwargs)[source]
Shortcut for sending the command to current graceGraph
see below

Convenience function to set the lower and/or upper bounds of the x-axis.

yaxis(*args, **kwargs)[source]

Shortcut for sending the command to current graceGraph see below

Set axis properties

Parameters:
min : float

Minimum axis value

max : float

Maximum axis value

scale : {‘normal’, ‘logarithmic’, or ‘reciprocal’ or respectivly ‘n’,’l’,’r’}

Sets type of axis

label : string or Label object

Label of the axis; see Label object. If string this is the label string. If list it determines [labelstring,charsize,place,color] place : ‘normal’,’both’,’opposite’

invert : {True,False}

Invert axis

formula : grace equation

Formula for ticklabel calculation eg. rescaling $t is label -> scaling as $t*1e5

charsize : float

Determines size, default 1

offset : list of float

Determines the position of the normal and opposite axis position

autotick : bool

Autoticking

tick : Tick object or list, False True

List of [major tick distance , minorticks number,majorsize,minorsize,position] position as one of ‘normal’,’both’,’opposite’ (first letter is enough) False True switch Ticks on and off see Tick for more

ticklabel : float, list, tickLabel object

With [format,precision,charsize,placeon] or only charsize format: ‘decimal’,’exponential’,’general’,’power’,’scientific’ precision : integer placeon : ‘normal’,’both’,’opposite’

bar : list or bar object

See bar object list=[onoff,color,linestyle,linewidth]

ylabel(*args, **kwargs)[source]
Shortcut for sending the command to current graceGraph
see below

Convenience function to set the yaxis label

ylimit(*args, **kwargs)[source]
Shortcut for sending the command to current graceGraph
see below

Convenience function to set the lower and/or upper bounds of the y-axis.

class jscatter.graceplot.Label(string=None, layout=None, place=None, charsize=None, font=None, color=None, axis=None)[source]

Used for labels of the x-axis and y-axis

output(axis)[source]

list output to sent to grace

class jscatter.graceplot.Line(type=None, linestyle=None, linewidth=None, color=None, pattern=None, baselinetype=None, baseline=None, dropline=None)[source]

Line objekt

Parameters:
type: int

0 None; 1 straigth; 2 left_stairs; 3 right_stairs; 4 Segments; 5 3-Segments

linestyle : int

1 is normal; 2 is dotted; 3 is dashed; 4 is long dashed; 5 is dot-dashed

linewidth : float

goes from 0 to 6 in increasing thickness

color : int

color

pattern : int

fill pattern 1 is solid, 0 is None, there are about 24 choices as dotted, dashed, squared.

baseline : int

show baseline

baselinetype : int

0 Zero; 1 set min: 2 set max; 3 graph min: 4 graph max; 5 set average

dropline : 0,1

drop line to baseline

output(dataset)[source]

list output to sent to grace

class jscatter.graceplot.Symbol(type=None, symbol=None, size=None, color=1, pattern=None, linewidth=None, linestyle=None, filltype=None, fillrule=None, fillcolor=None, fillpattern=None, char=None, charfont=None, skip=None, annotation=None, errorbar=None)[source]

Symbol object

Parameters:
type : None,’xy’,’xydy’,’xydxdy’,….,’bar’ ==> 0, 1, 2, 3, ….. 0

None is automatic determination inside grace

symbol : (0..11)

0 None, 1 circle, 2 square, 3 diamond, 4 triangle up, 5 triangle left, 6 triangle down, 7 triangle right, 8 +, 9 x, 10 *, 11 character,

size : float

Self explanatory, 0.5 is 50 in the GUI

pattern : int 0-24

The pattern of the outline of the symbol, usually it will be 1

linewidth : float

thickness of the outline of the symbol

linestyle : int

0 None, 1 solid, 2 points, 3 broken line

fillcolor : int

color the symbol is filled with, by default it is the same as the outline color.

fillpattern : int, 0..24

pattern of the fill, 1 is solid, 0 is None, there are about 24 choices as dotted, dashed, squared.

output(dataset)[source]

list output to sent to grace

class jscatter.graceplot.Tick(axis=None, onoff=True, major=None, minorticks=None, inout=None, majorsize=None, majorcolor=None, majorlinewidth=None, majorlinestyle=None, majorgrid=None, minorcolor=None, minorlinewidth=None, minorlinestyle=None, minorgrid=None, minorsize=None, placeon=None, type=None, default=None, TickLabel=None)[source]

Controls appearence of ticks on an axis.

Parameters:
onoff :

is either ‘on’ or ‘off’

major :

is the space between ticks?

minorticks :

is the number of minorticks between major ticks?

inout :

determines if they point ‘in’ or ‘out’ or ‘both’

majorsize :

determines how long the major ticks are

majorlinewidth :

is how thick the major ticks are

majorlinestyle :

is controls the linestle of the ticks and major gridlines

majorgrid :

turns the major grid lines ‘on’ or ‘off’

minorcolor :

is the color of the minor tick lines

minorlinewidth :
minorlinestyle :

controls the linestle of the ticks and minor gridlines

minorgrid :

turns the minor gridlines on

minorsize :

is the lengthe of the minor gridlines

placeon :

is it is usually set to ‘both’,’normal’,’opposite’

type :

is ? it is usually set to ‘auto’

default :

is ? a number

output(axis)[source]

list output to sent to grace

class jscatter.graceplot.TickLabel(axis=None, onoff=True, type=None, prec=None, format=None, append=None, prepend=None, angle=None, placeon=None, skip=None, stagger=None, op=None, sign=None, starttype=None, start=None, stoptype=None, stop=None, charsize=None, font=None, color=None)[source]

Ticklabels

Parameters:
onoff : ‘on’,’off’
type ‘auto’
prec
format :string ,’general’ is default

decimal,exponential,general,power,scientific

append : string

added to the end of the label

prepend : string

added to the beginning of the label

angle : float

degrees? of rotation

placeon : ‘normal’,’both’,’opposite’

where to place labels

skip : int which skips some labels somehow
stagger : is an integer that staggers the labels somehow
op : ‘bottom’ for x-axis, ‘left’ for y-axis
sign : ‘normal’
starttype : string ‘auto’
start : float don;t know what it does
stoptype : string ‘auto’
stop : float purpose?
charsize : float for character size
font : integer for the font
color : integer for the color
Returns:
TickLabel object
output(axis)[source]

list output to sent to grace

class jscatter.graceplot.createColorTable[source]
assign(idx, rgb, name)[source]
len
list
names
class jscatter.graceplot.fills[source]
none = 0
opaque = 8
solid = 1
jscatter.graceplot.format_scientific(val)[source]

format x.xxxe+-yy as a typeset grace string

class jscatter.graceplot.frames[source]
breakbottom = 3
breakleft = 4
breakright = 5
breaktop = 2
closed = 0
halfopen = 1
jscatter.graceplot.inheritDocstringFrom(cls)[source]
class jscatter.graceplot.lines[source]
dashed = 3
dot_dashed = 5
dotted = 2
long_dashed = 4
none = 0
solid = 1
jscatter.graceplot.on_off(flag)[source]

convert a bool into an xmgrace on/off string

class jscatter.graceplot.symbols[source]
character = 11
circle = 1
cross = 9
diamond = 3
none = 0
plus = 8
square = 2
star = 10
triangle_down = 6
triangle_left = 5
triangle_right = 7
triangle_up = 4