openmc.Plot

class openmc.Plot(plot_id=None, name='')[source]

Definition of a finite region of space to be plotted, either as a slice plot in two dimensions or as a voxel plot in three dimensions.

Parameters:
  • plot_id (int) – Unique identifier for the plot
  • name (str) – Name of the plot
Variables:
  • id (int) – Unique identifier
  • name (str) – Name of the plot
  • width (Iterable of float) – Width of the plot in each basis direction
  • pixels (Iterable of int) – Number of pixels to use in each basis direction
  • origin (tuple or list of ndarray) – Origin (center) of the plot
  • filename – Path to write the plot to
  • color ({'cell', 'mat'}) – Indicate whether the plot should be colored by cell or by material
  • type ({'slice', 'voxel'}) – The type of the plot
  • basis ({'xy', 'xz', 'yz'}) – The basis directions for the plot
  • background (tuple or list of ndarray) – Color of the background defined by RGB
  • mask_components (Iterable of int) – Unique id numbers of the cells or materials to plot
  • mask_background (Iterable of int) – Color to apply to all cells/materials not listed in mask_components defined by RGB
  • col_spec (dict) – Dictionary indicating that certain cells/materials (keys) should be colored with a specific RGB (values)
colorize(geometry, seed=1)[source]

Generate a color scheme for each domain in the plot.

This routine may be used to generate random, reproducible color schemes. The colors generated are based upon cell/material IDs in the geometry.

Parameters:
  • geometry (openmc.Geometry) – The geometry for which the plot is defined
  • seed (Integral) – The random number seed used to generate the color scheme
get_plot_xml()[source]

Return XML representation of the plot

Returns:element – XML element containing plot data
Return type:xml.etree.ElementTree.Element
highlight_domains(geometry, domains, seed=1, alpha=0.5, background='gray')[source]

Use alpha compositing to highlight one or more domains in the plot.

This routine generates a color scheme and applies alpha compositing to make all domains except the highlighted ones appear partially transparent.

Parameters:
  • geometry (openmc.Geometry) – The geometry for which the plot is defined
  • domains (Iterable of Integral) – A collection of the domain IDs to highlight in the plot
  • seed (Integral) – The random number seed used to generate the color scheme
  • alpha (Real in [0,1]) – The value to apply in alpha compisiting
  • background (3-tuple of Integral or 'white' or 'black' or 'gray') – The background color to apply in alpha compisiting