Demeter

Description Perl tools for X-ray Absorption Spectroscopy
Demeter > Perl Modules > Demeter::Plot
Source

NAME

Demeter::Plot - Controlling plots of XAS data

VERSION

This documentation refers to Demeter version 0.9.26.

SYNOPSIS

  $object -> po -> set(kweight=>3);

DESCRIPTION

This subclass of Demeter is for holding information pertaining to how plots of data and paths are made.

METHODS

This uses the set, and get methods of the parent class.

The typical way of accessing these methods is in a chain with the po method. All of the examples below demonstrate that. You can also store the reference to the plot object as a scalar and used that:

  $plot_object - $other_object -> po;
  $plot_object -> set(kweight=>3);
start_plot

This method reinitializes a plot. In terms of Ifeffit, the next plot made after running this method will be a newplot(). Each subsequent plot until the next time start_plot is called will be a plot(). Also, the sequence of colors is reset when this method is called.

  $object -> po -> start_plot;
legend

This is a convenience method for controlling the appearence of the legend in the plot. This will set the legend parameters (key_x, key_y, and key_dy) and return the Ifeffit command to reset the legend.

  $object -> po -> legend(x=>0.6, y=>0.8, dy=>0.05);

Note that you get to drop "key" in the arguments to this method, although x and key_x will be interpreted the same.

font

This is a convenience method for controlling the appearence of the text in the plot. This will set the text attributes (charfont and charsize) and return the Ifeffit command to reset the text.

  $object -> po -> font(font=>4, size=>1.8)

Note that you get to drop "char" in the arguments to this method, although font and charfont will be interpreted the same.

The available pgplot fonts are: 1=sans serif, 2=roman, 3=italic, 4=script. If the font is not one of those numbers, it will fall back to 1. The size cannot be negative. Values larger than around 1.8 are allowed, but are probably a poor idea.

label

Place a textual label on the plot at a specified point.

  $object -> po -> label($x, $y, $text);
plot_kylabel

Construct the label for the y-axis of a plot in k using the correct value of k-weighting according to the current value of the kweight attribute.

plot_rylabel

Construct the label for the y-axis of a plot in R using the correct value of k-weighting according to the current value of the kweight attribute.

plot_qylabel

Construct the label for the y-axis of a plot in q using the correct value of k-weighting according to the current value of the kweight attribute.

ATTRIBUTES

The following are the attributes of the Plot object. Attempting to access an attribute not on this list will throw an exception.

The type of argument expected in given in parentheses. i.e. number, integer, string, and so on. The default value, if one exists, is given in square brackets.

group (string) [a random five-letter string]

This string is used as the unique identifier for the Plot object.

space (letter) [r]

The space in which to preform the plot. It must be one of E, k, r, or q.

color

The next line color to be used. This is updated automatically by the plotting methods.

increment

A counter for the number of traces already drawn in the current plot.

new

A flag indicating whether to start a new plot or to plot over the current one.

Text and colors

charsize (number) [1.2]

The character size in PGPLOT plots.

charfont (integer) [1]

The font type used in plots with PGPLOT. The available fonts are: 1=sans serif, 2=roman, 3=italic, 4=script.

key_x (number) [0.8]

The location in x of the plot legend as a fraction of the full window width.

key_y (number) [0.9]

The location in y of the plot legend as a fraction of the full window height.

key_dy (number) [0.075]

The separation in y of the entried in the plot legend as a fraction of the full window height.

bg (color) [white]

The plot background color.

fg (color) [black]

The plot foreground color, used for text and the plot frame.

showlegend (boolean) [1]

When true, a legend will be shown on the plot.

showgrid (boolean) [1]

When true, a grid will be shown on the plot.

gridcolor (color) [grey82]

The color of the grid drawn on the plot.

c0 to c9 (color)

The line colors. These are the default colors (as defined in the X windows rgb.txt file) in order: blue red green4 darkviolet darkorange brown deeppink gold3 cyan3 yellowgreen.

Line types

The line type attributes take these possible values:

   solid dashed dotted dot-dash points linespoints
datastyle (string) [solid]

The line type for plots of data.

fitstyle (string) [solid]

The line type for the fit array.

partstyle (string) [solid]

The line type for a part of the data, such as the window or the background.

pathstyle (string) [solid]

The line type for a path.

Energy plots

emin (number) [-200]

The lower bound of the plot range in energy, relative to e0 of the data group.

emax (number) [800]

The upper bound of the plot range in energy, relative to e0 of the data group.

e_mu (boolean) [1]

A flag for whether to plot mu(E) in an energy plot.

e_bkg (boolean) [0]

A flag for whether to plot the background in an energy plot.

e_pre (boolean) [0]

A flag for whether to plot the pre-edge line in an energy plot.

e_post (boolean) [0]

A flag for whether to plot the post-edge line in an energy plot.

e_norm (boolean) [0]

A flag for whether to plot mu(E) and the background as normalized data in an energy plot.

e_der (boolean) [0]

A flag for whether to plot muE() as a derivative spectrum in an energy plot.

e_sec (boolean) [0]

A flag for whether to plot the mu(E) as a second derivative spectrum in an energy plot.

e_i0 (boolean) [0]

A flag for whether to plot I0 in an energy plot.

e_signal (boolean) [0]

A flag for whether to plot the signal (i.e. the unormalized transmission or fluorescence channel -- this combined with the I0 signal make up mu(E)) in an energy plot.

e_markers (boolean) [0]

If true, than markers will be plotted in energy as appropriate to indicate the positions of E0 and the boundaries of the pre- and post-edge resions.

e_part () []

q{},

e_smooth (integer) [0]

When non-zero, data plotted in energy will be smoothed using a three-point smoothing function. The number is the number of repititions of the smoothing function.

e_zero (boolean) [0]

When true, data plotted in energy have bkg_e0 subtracted from the energy array. Thus mu(E) data are plotted with the edge energy at 0. The purpose of this is to facilitate overplotting mu(E) data from different edges.

k plots

kmin (number) [0]

The lower bound of the plot range in k.

kmax (number) [15]

The upper bound of the plot range in k.

kweight (number) [1]

The k-weighting to use when plotting in k or in a Fourier transform before plotting in R or q. Typically, this is 1, 2, or 3, but can actually be any number. When this gets changed, all Data, Path, and VPath objects will be flagged as needing to be brought up-to-date for their forward Fourier transform.

A negative value is interpreted to mean that the value of fit_karb_value should be used as the k-weighting to each data group. This allows data to be overplotted with variable k-weighting.

chie (boolean) [0]

When this flag is true, plots of chi(k) will be plotted instead as chi(E).

R plots

rmin (number) [0]

The lower bound of the plot range in R.

rmax (number) [6]

The upper bound of the plot range in R.

r_pl (letter) [m]

The part of the Fourier transform to plot when making a multiple data set plot in R. The choices are m, p, r, and i for magnitude, phase, real, and imaginary.

dphase (boolean) [0]

When this flag is true, plots of the phase of chi(R) will be plotted in the derivative.

smag (boolean) [0]

When this flag is true, plots of the magnitude of chi(R) will be plotted in the second derivative. (Not implemented yet.)

q plots

qmin (number) [0]

The lower bound of the plot range in backtransform k.

qmax (number) [15]

The upper bound of the plot range in backtransform k.

q_pl (letter) [r]

The part of the Fourier transform to plot when making a multiple data set plot in q. The choices are m, p, r, and i for magnitude, phase, real, and imaginary.

Data parts

plot_data (boolean) [1]

When making a plot after a fit, the data will be plotted when this is true.

plot_fit (boolean) [0]

When making a plot after a fit, the fit will be plotted when this is true.

plot_win (boolean) [0]

When making a plot after a fit, the Fourier transform window will be plotted when this is true.

window_multiplier (number) [1.05]

This is the scaling factor by which the window is multipled so that it plots nicely with the data. The window will be multiplied by the value of the largest point in the plot, then by this number. => (is => 'rw', isa => 'Bool', default => 0);

plot_res (boolean) [0]

When making a plot after a fit, the residual will be plotted when this is true.

plot_run (boolean) [0]

When making a plot after a fit, the running R-factor will be plotted when this is true.

plot_bkg (boolean) [0]

When making a plot after a fit, the background will be plotted when this is true, if the background was corefined in the fit..

plot_paths (boolean) [0]

When making a plot after a fit, all paths used in the fit will be plotted when this is true.

Plot ornaments

indicatorcolor (color) [violetred]

The color of the plot indicators.

indicatorline (string) [solid]

The line type of the plot indicator. It must be one of

   solid dashed dotted dot-dash points linespoints
showmarker (boolean) [1]

Plot markers for things like e0 and the normalization range will be displayed when this true.

markertype (number) [9]

The point style of t he plot marker. In PGPLOT, this can be a number between 1 and 29 and 9 is a dotted circle.

markersize (number) [2]

The size of the plot marker.

markercolor (color) [orange]

The color of the plot marker.

DIAGNOSTICS

These messages are classified as follows (listed in increasing order of desperation):

    (W) A warning (optional).
    (F) A fatal error (trappable).
$key is not a valid Demeter::Data parameter

You have tried to set in invalid Plot parameter

Demeter::Plot: $k must be a number

You have attempted to set an attribute that takes a numerical value to something other than a number.

key_X must be a positive number

(W) You have tried to set one of the legend parameters to something that is not a positive number. It was reset to its default.

The font must be an integer from 1 to 4.

(W) There are only four types of fonts available and they are numbered 1 through 4. The font was reset to sans-serif, which is number 1.

The size must be a positive number

(W) You have tried to set the font size to something that is not a positive number. It was reset to size 1.2.

Demeter::Plot: $k must be one of solid, dashed, dotted, dot-dash, points, or linespoints

You have attempted to set an attribute controlling a line to an unknown line type.

Demeter::Plot: $k must be one of m, e, r, i, or p

You have set an attribute controlling which part of complex function is plotted to something that is not understood as complex function part. The choices are magnitude, envelope, real, imaginary, and phase.

SERIALIZATION AND DESERIALIZATION

Serialization of a Plot object is still an open question.

CONFIGURATION AND ENVIRONMENT

See Demeter::Config for a description of the configuration system. The plot and ornaments configuration groups control the attributes of the Plot object.

DEPENDENCIES

Demeter's dependencies are in the Build.PL file.

BUGS AND LIMITATIONS

Please report problems to the Ifeffit Mailing List (http://cars9.uchicago.edu/mailman/listinfo/ifeffit/)

Patches are welcome.

AUTHOR

Bruce Ravel (http://bruceravel.github.io/home)

http://bruceravel.github.io/demeter/

LICENCE AND COPYRIGHT

Copyright (c) 2006-2018 Bruce Ravel (http://bruceravel.github.io/home). All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlgpl.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.