Package pygtk_chart :: Module line_chart
[hide private]
[frames] | no frames]

Module line_chart

source code

Contains the LineChart widget.

Author: Sven Festersen (sven@sven-festersen.de)

Classes [hide private]
  RangeCalculator
This helper class calculates ranges.
  LineChart
A widget that shows a line chart.
  Axis
  XAxis
This class represents the xaxis.
  YAxis
This class represents the yaxis.
  Grid
A class representing the grid of the chart.
  Graph
This class represents a graph or the data you want to plot on your LineChart widget.
Functions [hide private]
 
graph_new_from_function(func, xmin, xmax, graph_name, samples=100, do_optimize_sampling=True)
Returns a line_chart.Graph with data created from the function y = func(x) with x in [xmin, xmax].
source code
 
optimize_sampling(func, data) source code
 
graph_new_from_file(filename, graph_name, x_col=0, y_col=1)
Returns a line_chart.Graph with point taken from data file filename.
source code
Variables [hide private]
  RANGE_AUTO = 0
  GRAPH_PADDING = 0.0666666666667
  GRAPH_POINTS = 1
  GRAPH_LINES = 2
  GRAPH_BOTH = 3
  COLOR_AUTO = 4
  POSITION_AUTO = 5
  POSITION_LEFT = 6
  POSITION_RIGHT = 7
  POSITION_BOTTOM = 6
  POSITION_TOP = 7
  COLORS = [(0.8, 0.0, 0.0), (0.203921568627, 0.396078431373, 0....
Function Details [hide private]

graph_new_from_function(func, xmin, xmax, graph_name, samples=100, do_optimize_sampling=True)

source code 

Returns a line_chart.Graph with data created from the function y = func(x) with x in [xmin, xmax]. The id of the new graph is graph_name. The parameter samples gives the number of points that should be evaluated in [xmin, xmax] (default: 100). If do_optimize_sampling is True (default) additional points will be evaluated to smoothen the curve.

Parameters:
  • func (a function) - the function to evaluate
  • xmin (float) - the minimum x value to evaluate
  • xmax (float) - the maximum x value to evaluate
  • graph_name (string) - a unique name for the new graph
  • samples (int) - number of samples
  • do_optimize_sampling (boolean) - set whether to add additional points
Returns:
line_chart.Graph

graph_new_from_file(filename, graph_name, x_col=0, y_col=1)

source code 

Returns a line_chart.Graph with point taken from data file filename. The id of the new graph is graph_name.

Data file format: The columns in the file have to be separated by tabs or one or more spaces. Everything after '#' is ignored (comment).

Use the parameters x_col and y_col to control which columns to use for plotting. By default, the first column (x_col=0) is used for x values, the second (y_col=1) is used for y values.

Parameters:
  • filename (string) - path to the data file
  • graph_name (string) - a unique name for the graph
  • x_col (int) - the number of the column to use for x values
  • y_col (int) - the number of the column to use for y values
Returns:
line_chart.Graph

Variables Details [hide private]

COLORS

Value:
[(0.8, 0.0, 0.0),
 (0.203921568627, 0.396078431373, 0.643137254902),
 (0.450980392157, 0.823529411765, 0.0862745098039),
 (0.960784313725, 0.474509803922, 0.0),
 (0.458823529412, 0.313725490196, 0.482352941176),
 (0.756862745098, 0.490196078431, 0.0666666666667),
 (0.929411764706, 0.83137254902, 0.0)]