rootpy.plotting.contrib.plot_contour_matrix

rootpy.plotting.contrib.plot_contour_matrix(arrays, fields, filename, weights=None, sample_names=None, sample_lines=None, sample_colors=None, color_map=None, num_bins=20, num_contours=3, cell_width=2, cell_height=2, cell_margin_x=0.05, cell_margin_y=0.05, dpi=100, padding=0, animate_field=None, animate_steps=10, animate_delay=20, animate_loop=0)[source]

Create a matrix of contour plots showing all possible 2D projections of a multivariate dataset. You may optionally animate the contours as a cut on one of the fields is increased. ImageMagick must be installed to produce animations.

Parameters:

arrays : list of arrays of shape [n_samples, n_fields]

A list of 2D NumPy arrays for each sample. All arrays must have the same number of columns.

fields : list of strings

A list of the field names.

filename : string

The output filename. If animatation is enabled animate_field is not None then filename must have the .gif extension.

weights : list of arrays, optional (default=None)

List of 1D NumPy arrays of sample weights corresponding to the arrays in arrays.

sample_names : list of strings, optional (default=None)

A list of the sample names for the legend. If None, then no legend will be shown.

sample_lines : list of strings, optional (default=None)

A list of matplotlib line styles for each sample. If None then line styles will cycle through ‘dashed’, ‘solid’, ‘dashdot’, and ‘dotted’. Elements of this list may also be a list of line styles which will be cycled through for the contour lines of the corresponding sample.

sample_colors : list of matplotlib colors, optional (default=None)

The color of the contours for each sample. If None, then colors will be selected according to regular intervals along the color_map.

color_map : a matplotlib color map, optional (default=None)

If sample_colors is None then select colors according to regular intervals along this matplotlib color map. If color_map is None, then the spectral color map is used.

num_bins : int, optional (default=20)

The number of bins along both axes of the 2D histograms.

num_contours : int, optional (default=3)

The number of contour line to show for each sample.

cell_width : float, optional (default=2)

The width, in inches, of each subplot in the matrix.

cell_height : float, optional (default=2)

The height, in inches, of each subplot in the matrix.

cell_margin_x : float, optional (default=0.05)

The horizontal margin between adjacent subplots, as a fraction of the subplot size.

cell_margin_y : float, optional (default=0.05)

The vertical margin between adjacent subplots, as a fraction of the subplot size.

dpi : int, optional (default=100)

The number of pixels per inch.

padding : float, optional (default=0)

The padding, as a fraction of the range of the value along each axes to guarantee around each sample’s contour plot.

animate_field : string, optional (default=None)

The field to animate a cut along. By default no animation is produced. If animate_field is not None then filename must end in the .gif extension and an animated GIF is produced.

animate_steps : int, optional (default=10)

The number of frames in the animation, corresponding to the number of regularly spaced cut values to show along the range of the animate_field.

animate_delay : int, optional (default=20)

The duration that each frame is shown in the animation as a multiple of 1 / 100 of a second.

animate_loop : int, optional (default=0)

The number of times to loop the animation. If zero, then loop forever.

Notes

NumPy and matplotlib are required