Histogramx

_images/Histogramx.jpg
class decida.Histogramx.Histogramx(parent=None, **kwargs)

Bases: decida.PlotBase.PlotBase

synopsis:

Plot histogram of vector values.

Histogramx plots a histogram of counts of a 1-dimensional array of values. For each data value, if it is within the range of a particular histogram bin, that bin’s count is incremented.

The set of histogram bins are specified by configuration options, but can be changed by using the Edit->Settings dialog.

constructor arguments:

parent (Tkinter handle, default=None)

handle of frame or other widget to pack plot in. if this is not specified, top-level is created.

**kwargs (dict)

keyword=value specifications: options or configuration-options

options:

command (list)

list of pairs of data-object, string of x, ?x1, x2, ...? columns

example: [d1, “x x1 x2”, d2, “x x1 x2”]:
x, x1, and x2 histograms will be plotted for each data object d1 and d2. Each histogram will also be plotted with color selected from the successive item in the list of specified colors configuration option. Selection wraps around if the respective list is shorter than the number of curves.

configuration options:

verbose (bool, default=False)

enable/disable verbose mode

title (str, default=””)

main title

xtitle (str, default=””)

x-axis title

ytitle (str, default=””)

y-axis title

plot_height (str, default=”10i” for MacOS, else “6i”)

Height of plot window (Tk inch or pixelspecification)

plot_width (str, default=”10i” for MacOS, else “6i”)

Width of plot window (Tk inch or pixel specification)

plot_background (str, default=”GhostWhite”)

Background color of plot window

legend_background (str, default=”AntiqueWhite2”)

Background color of legend

nbins (int, default=21)

number of histogram bins between binorigin and nbins*binsize.

binsize (float, default=1.0)

size of each histogram bin.

binorigin (float, default=0.0)

minimum of histogram bins.

bar_width (float, default=1.0)

width of each histogram bar.

bar_outline (str, default=”black”)

color or each histogram bar.
colors (list of str, default = [
“blue”, “red”, “green”, “orange”, “cyan”, “brown”, “black”, “blue violet”, “cadet blue”, “dark cyan”, “dark goldenrod”, “dark green”, “dark magenta”, “dark olive green”, “dark orange”, “dark red”, “dark slate blue”, “dark slate gray”, “dodger blue”, “forest green”, “steel blue”, “sienna”])

list of colors for curves. Used to populate color menu, and to specify curve colors in scripted “command” option.

symbols (list of str, default = [
“none”, “dot”, “square”, “diamond”, “triangle”, “itriangle”, “dash”, “pipe”, “plus”, “cross”, “spade”, “heart”, “diam”, “club”, “shamrock”, “fleurdelis”, “circle”, “star”])

list of symbols for curves. Used to populate symbol menu, and to specify curve symbols in scripted “command” option.

ssizes (list of float, default = [0.01])

list of symbol sizes for curves. Used to specify curve symbol sizes in scripted “command” option.

wlines (list of int, default = [1])

list of line widths for curves. Used to specify curve line widths in scripted “command” option.

traces (list, default = [“increasing”])

list of traces for curves. each trace can be one of: “increasing”, “decreasing”, or “both”. Used to specify curve trace directions in scripted “command” option.

xaxis (str, default=”lin”)

linear or logarithmic axis: “lin” or “log”

yaxis (str, default=”lin”)

linear or logarithmic axis: “lin” or “log”

xmin (float, default=0.0)

xaxis minimum

xmax (float, default=0.0)

xaxis maximum

ymin (float, default=0.0)

yaxis minimum

ymax (float, default=0.0)

yaxis maximum

grid (bool, default=True)

if true, show grid on plot

legend (bool, default=True)

if true, show legend on plot

postscript (bool, default=False)

if true, generate a PostScript file.

postscript_file (str, default=”plot.ps”)

name of PostScript file to plot to

wait (bool, default=False)

wait in main-loop until window is destroyed.

destroy (bool, default=False)

destroy main window after it has been displayed. useful for displaying, generating PostScript, then destroying window.

example (from test_Histogramx_1):

from decida.Data import Data
from decida.Histogramx import Histogramx
d = Data()
d.read("smartspice_tr_binary.raw")
h=Histogramx(None, command=[d, "v(cint)"], nbins=51)

public methods:

  • public methods from PlotBase (2-dimensinal plot base class)