plotting Package

plotting Package

Plotting functions for distarrays.

plotting Module

Plotting functions for distarrays.

distarray.plotting.plotting.cmap_discretize(cmap, N)

Create a discrete colormap from the continuous colormap cmap.

  • cmap (colormap instance, or string) – The continuous colormap, as object or name, to make discrete. For example,, or ‘jet’.
  • N (int) – The number of discrete colors desired.

The desired discrete colormap.

Return type:



>>> x = resize(arange(100), (5,100))
>>> djet = cmap_discretize(cm.jet, 5)
>>> pyplot.imshow(x, cmap=djet)

Create colormap objects for a discrete colormap.

Parameters:num_values (The number of distinct colors to use.) –
Returns:cmap, norm, text_colors – The matplotlib colormap, norm, and recommended text colors. text_colors is an array of length num_values, with each entry being a nice color for text drawn on top of the colormap selection.
Return type:tuple

Given a distarray arr, return a distarray with the same shape, but with the elements equal to the rank of the process the element is on.

distarray.plotting.plotting.plot_array_distribution(darray, process_coords, title=None, xlabel=None, ylabel=None, yflip=False, cell_label=True, legend=False, global_plot_filename=None, local_plot_filename=None, *args, **kwargs)

Plot a distarray’s memory layout. It can be 1D or 2D. Elements are colored according to the process they are on.

  • darray (DistArray) – The distributed array to plot.
  • process_coords (List of tuples.) – The process grid coordinates.
  • title (string) – Text label for the plot title, or None.
  • xlabel (string) – Text label for the x-axis, or None.
  • ylabel (string) – Text label for the y-axis, or None.
  • yflip (bool) – If True, then the y-axis increases downwards, to match the layout when printing the array itself.
  • cell_label (bool) – If True, then each cell in the plot is labeled with the array value. This can look cluttered for large arrays.
  • legend (bool) – If True, then a colorbar legend is drawn to label the colors.
  • global_plot_filename (string) – Output filename for the global array plot image.
  • local_plot_filename (string) – Output filename for the local array plot image.

The process assignment array, as a DistArray.

Return type:


distarray.plotting.plotting.plot_local_array_subfigure(subfig, local_array, process, coord, colormap_objects, *args, **kwargs)

Plot a single local_array into a matplotlib subfigure.

distarray.plotting.plotting.plot_local_arrays(darray, process_coords, colormap_objects, filename)

Plot the local arrays as a multi-figure matplotlib plot.