Package Biskit :: Module plotUtils
[hide private]
[frames] | no frames]

Module plotUtils

source code

bar-plotting for Biggles

Classes [hide private]
  Test
Test class

Functions [hide private]
[float],[float] multibar_curve(values, x0=None, xwidth=0.25, xsep=0.15)
Get x,y values to draw many bars.
[ float ], [ float ] bar_curve(height, x0, xwidth=0.25, y0=0.)
Get x,y values for a single bar.
float, float, float, float boxed_diagonal(x0, y0, x1, y1, vy)
Get a diagonal connecting left (x0) to right (x1) edge but which is only visible within a rectangular box.
[Biggles.Curve] line_fill(x0, y0, x1, y1, sep=0.1, size=0.06, color='black', **kw)
Fill the rectangle described by x0, y0, x1, y1 with horizontal lines.
[Biggles.FillBetween] bar_fill(x0, y0, x1, y1, sep=0.1, size=0.06, color='grey', **kw)
Fill the rectangle described by x0, y0, x1, y1 with horizontal bars.
[Biggles.FillBetween] diagonal_fill(x0, y0, x1, y1, sep=0.2, size=0.05, invert=0, **kw)
Fill the rectangle described by x0,y0, x1,y1 (lower left and upper right corner) with diagonal bars.
[Biggles.Curve] diagonal_line_fill(x0, y0, x1, y1, sep=0.2, size=0.05, invert=0, **kw)
Fill the rectangle described by x0,y0, x1,y1 (lower left and upper right corner) with diagonal lines.
[Biggles.FillBetween] solid_fill(x0, y0, x1, y1, **kw)
Fill the rectangle described by x0,y0, x1,y1 (lower left and upper right corner).
biggles.Curv box_curve(x0, y0, x1, y1, **kw)
A rectangle described by x0,y0, x1,y1 (lower left and upper right corner).
biggles.FillBetween box_fill(x0, y0, x1, y1, **kw)
Fill for a rectangle described by x0,y0, x1,y1 (lower left and upper right corner).
  add_box(p, x0, y0, x1, y1, fillfunc=solid_fill, **kw)
Add single filled box to plot.
  fill_bars(p, values, x0=None, xwidth=0.25, xoffset=1, fillfunc=solid_fill, margin=0.01, **kw)
Add filling to bars described y values, left-most x, width and offset.
  add_bars(p, values, x0=None, xwidth=0.25, xoffset=1, fillfunc=solid_fill, **kw)
Add bars to plot, described by y values, left-most x, width and offset.
biggles.FillBetween prepare_plot(xlabel='', ylabel='', yrange=None, xrange=None, width=500, height=350)
Initiate a biggles.FramedPlot object.

Variables [hide private]
  B = 0
  test = Test()

Function Details [hide private]

multibar_curve(values, x0=None, xwidth=0.25, xsep=0.15)

source code 

Get x,y values to draw many bars.
Parameters:
  • values ([float]) - values to bar-plot
  • x0 (float) - start of first bar
  • xwidth (float) - width of bars (default: 0.25)
  • xsep (float) - space between bars (default: 0.15)
Returns: [float],[float]
x,y values that draw a bar for each y value

Note: not used at the moment because it draws connecting line at the bottom

bar_curve(height, x0, xwidth=0.25, y0=0.)

source code 

Get x,y values for a single bar.
Parameters:
  • height (float) - height of bar
  • x0 (float) - start of first bar
  • xwidth (float) - width of bars (default: 0.25)
  • y0 (float) - start of first bar
Returns: [ float ], [ float ]
x,y values that draw a single bar.

boxed_diagonal(x0, y0, x1, y1, vy)

source code 

Get a diagonal connecting left (x0) to right (x1) edge but which is only visible within a rectangular box.
Parameters:
  • x0 (float) - rectangular window of visibility
  • y0 (float) - rectangular window of visibility
  • x1 (float) - rectangular window of visibility
  • y1 (float) - rectangular window of visibility
  • vy (float) - virtual starting point (y-coordinate, may be outside of the box)
Returns: float, float, float, float
xa, ya, xb, yb - start and end point of a diagonal line originating at (x0, vy) but beeing only visible within the rectangle (x0,y0,x1,y1)

line_fill(x0, y0, x1, y1, sep=0.1, size=0.06, color='black', **kw)

source code 

Fill the rectangle described by x0, y0, x1, y1 with horizontal lines.
Parameters:
  • x0 (float) - rectangular coorinates
  • y0 (float) - rectangular coorinates
  • x1 (float) - rectangular coorinates
  • y1 (float) - rectangular coorinates
  • sep (float) - separation between lines (default: 0.1)
  • size (float) - line thickness (default: 0.06)
  • color (str) - color name (default: black)
  • kw (key=value) - additional key-value pairs
Returns: [Biggles.Curve]
list of biggles plot objects

bar_fill(x0, y0, x1, y1, sep=0.1, size=0.06, color='grey', **kw)

source code 

Fill the rectangle described by x0, y0, x1, y1 with horizontal bars.
Parameters:
  • x0 (float) - rectangular coorinates
  • y0 (float) - rectangular coorinates
  • x1 (float) - rectangular coorinates
  • y1 (float) - rectangular coorinates
  • sep (float) - separation between lines (default: 0.1)
  • size (float) - line thickness (default: 0.06)
  • color (str) - color name (default: grey)
  • kw (key=value) - additional key-value pairs
Returns: [Biggles.FillBetween]
list of biggles plot objects

diagonal_fill(x0, y0, x1, y1, sep=0.2, size=0.05, invert=0, **kw)

source code 

Fill the rectangle described by x0,y0, x1,y1 (lower left and upper right corner) with diagonal bars.
Parameters:
  • x0 (float) - rectangular coorinates
  • y0 (float) - rectangular coorinates
  • x1 (float) - rectangular coorinates
  • y1 (float) - rectangular coorinates
  • sep (float) - offset between (low edges of) diagonal lines (default: 0.2)
  • size (float) - width of diagonal line (default: 0.05)
  • invert (1|0) - mirror diagonals (default: 0)
  • kw (key=value) - additional key-value pairs
Returns: [Biggles.FillBetween]
list of biggles plot objects

diagonal_line_fill(x0, y0, x1, y1, sep=0.2, size=0.05, invert=0, **kw)

source code 

Fill the rectangle described by x0,y0, x1,y1 (lower left and upper right corner) with diagonal lines.
Parameters:
  • x0 (float) - rectangular coorinates
  • y0 (float) - rectangular coorinates
  • x1 (float) - rectangular coorinates
  • y1 (float) - rectangular coorinates
  • sep (float) - offset between (low edges of) diagonal lines (default: 0.2)
  • size (float) - width of diagonal line (default: 0.05)
  • invert (1|0) - mirror diagonals (default: 0)
  • kw (key=value) - additional key-value pairs
Returns: [Biggles.Curve]
list of biggles plot objects

solid_fill(x0, y0, x1, y1, **kw)

source code 

Fill the rectangle described by x0,y0, x1,y1 (lower left and upper right corner).
Parameters:
  • x0 (float) - rectangular coorinates
  • y0 (float) - rectangular coorinates
  • x1 (float) - rectangular coorinates
  • y1 (float) - rectangular coorinates
  • kw (key=value) - additional key-value pairs
Returns: [Biggles.FillBetween]
list of biggles plot objects

box_curve(x0, y0, x1, y1, **kw)

source code 

A rectangle described by x0,y0, x1,y1 (lower left and upper right corner).
Parameters:
  • x0 (float) - rectangular coorinates
  • y0 (float) - rectangular coorinates
  • x1 (float) - rectangular coorinates
  • y1 (float) - rectangular coorinates
  • kw (key=value) - additional key-value pairs
Returns: biggles.Curv
biggles plot object

box_fill(x0, y0, x1, y1, **kw)

source code 

Fill for a rectangle described by x0,y0, x1,y1 (lower left and upper right corner).
Parameters:
  • x0 (float) - rectangular coorinates
  • y0 (float) - rectangular coorinates
  • x1 (float) - rectangular coorinates
  • y1 (float) - rectangular coorinates
  • kw (key=value) - additional key-value pairs
Returns: biggles.FillBetween
biggles plot object

add_box(p, x0, y0, x1, y1, fillfunc=solid_fill, **kw)

source code 

Add single filled box to plot.
Parameters:
  • p (biggles.FramedPlot) - plot object which to add rectangle to
  • x0 (float) - rectangular coorinates, lower left corner
  • y0 (float) - rectangular coorinates, lower left corner
  • x1 (float) - rectangular coorinates, upper right corner
  • y1 (float) - rectangular coorinates, upper right corner
  • fillfunc - function name (default: solid_fill) @type fillfunc str
  • kw (key=value) - arguments for fillfunc and (starting with 'l') for Curve

fill_bars(p, values, x0=None, xwidth=0.25, xoffset=1, fillfunc=solid_fill, margin=0.01, **kw)

source code 

Add filling to bars described y values, left-most x, width and offset.
Parameters:
  • p (Biggles.FramedPlot) - fill objects are added directly to the plot
  • values ([float]) - bar heights
  • x0 (float) - left edge of first bar (default: None, xwidth)
  • xwidth (float) - width of each bar (default: 0.25)
  • xoffset (float) - distance between bars (measured between left edges) (default: 1)
  • fillfunc (str) - function solid_fill | line_fill | diagonal_fill | bar_fill
  • kw (key=value) - attributes for fill function, e.g. color, size, sep

add_bars(p, values, x0=None, xwidth=0.25, xoffset=1, fillfunc=solid_fill, **kw)

source code 

Add bars to plot, described by y values, left-most x, width and offset.
Parameters:
  • p (Biggles.FramedPlot) - fill objects are added directly to the plot
  • values ([float]) - bar heights
  • x0 (float) - left edge of first bar (default: None, xwidth)
  • xwidth (float) - width of each bar (default 0.25)
  • xoffset (float) - distance between bars (measured between left edges) (default 1)
  • fillfunc (str) - function solid_fill | line_fill | diagonal_fill | bar_fill | None
  • kw (key=value) - attributes for fill function (e.g. color, size, sep) and Curve (the latter ones have to start with "l", e.g. lcolor)

prepare_plot(xlabel='', ylabel='', yrange=None, xrange=None, width=500, height=350)

source code 

Initiate a biggles.FramedPlot object.
Parameters:
  • xlabel (str) - label for x-axis
  • ylabel (str) - label for y-axis
  • yrange ((float,float)) - range of y-axis
  • xrange ((float,float)) - range of x-axis
  • width (int) - hard plot width (in pixels or cm)
  • height (int) - hard plot height
Returns: biggles.FillBetween
biggles plot object

Variables Details [hide private]

B

Value:
0                                                                      
      

test

Value:
Test()