plotting Package¶
plotting
Package¶
Plotting functions for distarrays.
plotting
Module¶
Plotting functions for distarrays.
-
distarray.plotting.plotting.
cmap_discretize
(cmap, N)[source]¶ Create a discrete colormap from the continuous colormap cmap.
Parameters: - cmap (colormap instance, or string) – The continuous colormap, as object or name, to make discrete. For example, matplotlib.cm.jet, or ‘jet’.
- N (int) – The number of discrete colors desired.
Returns: The desired discrete colormap.
Return type: colormap
Example
>>> x = resize(arange(100), (5,100)) >>> djet = cmap_discretize(cm.jet, 5) >>> pyplot.imshow(x, cmap=djet)
-
distarray.plotting.plotting.
create_discrete_colormaps
(num_values)[source]¶ 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
-
distarray.plotting.plotting.
get_ranks
(arr)[source]¶ 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)[source]¶ Plot a distarray’s memory layout. It can be 1D or 2D. Elements are colored according to the process they are on.
Parameters: - 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.
Returns: The process assignment array, as a DistArray.
Return type: out