Module pepper.plotutils

Common utility functions for plotting. Please note that this is a Lua module. If you want to use it, add

require "pepper.plotutils"
to your script. The functions in this module are provided to facilate common plotting tasks and to remove duplicate code for the built-in reports.

Functions

add_plot_options (r) Adds common options for graphical reports to the given table.
add_tagmarks (plot, repo, pattern) Adds x2tics for repository tags.
convepoch (time) Converts from UNIX to Gnuplot epoch.
normalize_pie (values) Normalizes the given values for using the in a pie chart.
setup_output (plot, width, height) Sets the plot output size, type and filename from command-line options.
setup_std_time (plot, options) Performs a standard plot setup for time data.


Functions

add_plot_options (r)
Adds common options for graphical reports to the given table. The following options will be added:
OptionDescription
-oARG, --output=ARGSelect output file
-tARG, --type=ARGExplicitly set image type
-sW[xH], --size=W[xH]Set image size to width W and height H

Parameters

  • r: If not null, options will be added to this table. Else, the global meta.options table will be used.
add_tagmarks (plot, repo, pattern)
Adds x2tics for repository tags. If pattern is not nil, only tags matching the pattern will be added.

Parameters

  • plot: pepper.plot obejct
  • repo: pepper.repository object
  • pattern: Optional pattern for filtering tags
convepoch (time)
Converts from UNIX to Gnuplot epoch.

Parameters

  • time: UNIX timestamp
normalize_pie (values)
Normalizes the given values for using the in a pie chart.

Parameters

  • values: A table of values
setup_output (plot, width, height)
Sets the plot output size, type and filename from command-line options.

Parameters

  • plot: pepper.plot object
  • width: Optional width, 640 by default
  • height: Optional height, 480 by default
setup_std_time (plot, options)
Performs a standard plot setup for time data. Basically, this evaluates to the following GNUPlot commands (without comments):
 set xdata time           # X values of data are time values
set timefmt "%s" # Time values are given as UNIX timestamps
set yrange [0:*] # Start Y axis at 0
set xtics nomirror # Don't mirror X axis tics
set xtics rotate by -45 # Rotate X axis labels
set rmargin 8 # Make sure there's enough space for the rotated labels
set grid ytics # Show grid lines for the Y axis tics
The options parameter can be used to customize the plot. The following keys are supported:
KeyDescriptionDefault value
keyKey positionNo key
xformatX axis labels format"%b %y"
yformatY axis labels format"%'.0f"

Parameters

  • plot: pepper.plot object
  • options: Optional dictionary with additional options

Valid XHTML 1.0!