Please note that we are talking about graph styles here. Those are responsible for plotting symbols, lines, bars and whatever else into a graph. Do not mix it up with path styles like the line width, the line style (solid, dashed, dotted etc.) and others.
The following classes provide styles to be used at the plot() method of a graph. The plot method accepts a list of styles. By that you can combine several styles at the very same time.
Some of the styles below are hidden styles. Those do not create any output, but they perform internal data handling and thus help on modularization of the styles. Usually, a visible style will depend on data provided by one or more hidden styles but most of the time it is not necessary to specify the hidden styles manually. The hidden styles register themself to be the default for providing certain internal data.
| epsilon=1e-10) |
| usenames=, epsilon=1e-10) |
X for each
dimension errorbar data should be provided as follows:
| data name | description |
|---|---|
Xmin |
minimal value |
Xmax |
maximal value |
dX |
minimal and maximal delta |
dXmin |
minimal delta |
dXmax |
maximal delta |
X itself. usenames allows to insert a
translation dictionary from axis names to the identifiers X.
epsilon is a comparison precision when checking for invalid errorbar ranges.
| symbol=changecross, size=0.2*unit.v_cm, symbolattrs=[]) |
symbol(c, x_pt, y_pt, size_pt, attrs) and draws
the symbol into the canvas c at the position (x_pt,
y_pt) with size size_pt and attributes attrs. Some
predefined symbols are available in member variables listed below.
The symbol is drawn at size size using symbolattrs.
symbolattrs is merged with defaultsymbolattrs which is
a list containing the decorator deco.stroked. An instance of
symbol is the default style for all graph data classes
described in section 4.4 except for function
and paramfunction.
The class symbol provides some symbol functions as member variables, namely:
symbol provides some changeable symbol functions as member variables, namely:
The class symbol provides two changeable decorators for alternated filling and stroking. Those are especially useful in combination with the change-twice-symbol methods above. They are:
| lineattrs=[]) |
defaultlineattrs which is
a list containing the member variable changelinestyle as
described below. An instance of line is the default style
of the graph data classes function and paramfunction
described in section 4.4.
The class line provides a changeable line style. Its definition is:
| lineattrs=[], fromvalue=0, frompathattrs=[], valueaxisindex=1) |
defaultlineattrs which is a list containing the member
variable changelinestyle of the line class.
fromvalue is the baseline value of the impulses. When set to
None, the impulses will start at the baseline. When fromvalue
is set, frompathattrs are the stroke attributes used to show
the impulses baseline path.
| size=0.1*unit.v_cm, errorbarattrs=[], epsilon=1e-10) |
| textname="text", dxname=None, dyname=None, dxunit=0.3*unit.v_cm, dyunit=0.3*unit.v_cm, textdx=0*unit.v_cm, textdy=0.3*unit.v_cm, textattrs=[]) |
textname. textdx and textdy are the position of the
text with respect to the position in the graph. Alternatively you can
specify a dxname and a dyname and provide appropriate
data in those columns to be taken in units of dxunit and
dyunit to specify the position of the text for each point
separately. textattrs are text attributes for the output of
the text. Those attributes are merged with the default attributes
textmodule.halign.center and textmodule.vshift.mathaxis.
| linelength=0.25*unit.v_cm, arrowsize=0.15*unit.v_cm, lineattrs=[], arrowattrs=[], arrowpos=0.5, epsilon=1e-10) |
size and angle define the size and angle for each
arrow. size is taken as a factor to arrowsize and
linelength, the size of the arrow and the length of the line
the arrow is plotted at. angle is the angle the arrow points
to with respect to a horizontal line. The angle is taken in
degrees and used in mathematically positive sense. lineattrs
and arrowattrs are styles for the arrow line and arrow head,
respectively. arrowpos defines the position of the arrow line
with respect to the position at the graph. The default 0.5
means centered at the graph position, whereas 0 and 1
creates the arrows to start or end at the graph position,
respectively. epsilon is used as a cutoff for short arrows in
order to prevent numerical instabilities.
| gradient=color.gradient.Grey) |
color specifies the color of the rectangle
defined by gradient. The valid color range is [0:1].
| lineattrs=[], steps=0, fromvalue=0, frompathattrs=[], fillable=0, rectkey=0, autohistogramaxisindex=0, autohistogrampointpos=0.5, epsilon=1e-10) |
defaultlineattrs which is [deco.stroked]. When
steps is set, the histrogram is plotted as steps instead of
the default being a boxed histogram. fromvalue is the baseline
value of the histogram. When set to None, the histogram will
start at the baseline. When fromvalue is set, frompathattrs
are the stroke attributes used to show the histogram baseline path.
The fillable flag changes the stoke line of the histogram to make it fillable properly. This is important on non-steped histograms or on histograms, which hit the graph boundary. rectkey can be set to generate a rectanglar area instead of a line in the graph key.
Usually, a histogram wants a range specification (like for an
errorbar) in one graph dimension and a value for the other graph
dimension. By that, the widths of the histogram boxes might be
variable. But a typical use case is, that you just provide graph
positions for both graph dimensions. Then
autohistogramaxisindex defines the graph dimension where the
histogram should be plotted on top of it. (0 thus means a
histogram at the x axes and 1 for the y axes.) The style will
then demand equal spaced values on this axis. The histogram boxes
are usually centered on those values for autohistogrampointpos
equals 0.5, but they can also be aligned at the right side or
left side of this value for autohistogrampointpos being
0 or 1.
Positions of the histograms are considered to be out of graph when they exceed the graph coordinate range [0:1] by more than epsilon.
| fromvalue=None, frompathattrs=[], epsilon=1e-10) |
Xname where
X is an axis name. In the other graph dimension the data
column name must be equal to an axis name. To plot several bars in a
single graph side by side, you need to have a nested bar axis and
provide a tuple as data for nested bar axis.
The bars start at fromvalue when provided. The fromvalue is marked by a gridline stroked using frompathattrs. Thus this hidden style might actually create some output. The value of a bar axis is considered to be out of graph when its position in graph coordinates exceeds the range [0:1] by more than epsilon.
| stackname, addontop=0, epsilon=1e-10) |
| barattrs=[]) |
defaultbarattrs
which is a list containing [color.gradient.Rainbow,
deco.stroked([color.grey.black])].
| barattrs=[]) |
| index1=0, index2=1, gridlines1=1, gridlines2=1, gridattrs=[], epsilon=1e-10) |
| gridlines1=1, gridlines2=1, gridattrs=[]) |
defaultgridattrs which is a list containing the member
variable changelinestyle of the line class.
| colorname="color", gradient=color.gradient.Grey, mincolor=None, maxcolor=None, gridlines1=0.05, gridlines2=0.05, gridcolor=None, backcolor=color.gray.black) |
The grid can be colored using values provided by the data column named columnname. The values are rescaled to the range [0:1] using mincolor and maxcolor (which are taken from the minimal and maximal values, but larger bounds could be set).
If no columnname column exists, the surface style falls back to a lightning coloring taking into account the angle between the view ray and the triangle and the distance between viewer and triangle. The precise conversion is defined in the lightning method.
If a gridcolor is set, the rectangular grid is marked by small stripes of the relative (compared to each rectangle) size of gridlines1 and gridlines2 for the first and second grid direction, respectively.
backcolor is used to fill triangles shown from the back. If
backcolor is set to None, back sides are not drawn
differently from the front sides.
The surface is encoded using a single mesh. While this is quite space efficient, it has the following implications: