openmc.Plots

class openmc.Plots(plots=None)[source]

Collection of Plots used for an OpenMC simulation.

This class corresponds directly to the plots.xml input file. It can be thought of as a normal Python list where each member is a Plot. It behaves like a list as the following example demonstrates:

>>> xz_plot = openmc.Plot()
>>> big_plot = openmc.Plot()
>>> small_plot = openmc.Plot()
>>> p = openmc.Plots((xz_plot, big_plot))
>>> p.append(small_plot)
>>> small_plot = p.pop()
Parameters:plots (Iterable of openmc.Plot) – Plots to add to the collection
add_plot(plot)[source]

Add a plot to the file.

Deprecated since version 0.8: Use Plots.append() instead.

Parameters:plot (openmc.Plot) – Plot to add
append(plot)[source]

Append plot to collection

Parameters:plot (openmc.Plot) – Plot to append
colorize(geometry, seed=1)[source]

Generate a consistent color scheme for each domain in each plot.

This routine may be used to generate random, reproducible color schemes. The colors generated are based upon cell/material IDs in the geometry. The color schemes will be consistent for all plots in “plots.xml”.

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

Create a plots.xml file that can be used by OpenMC.

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 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
insert(index, plot)[source]

Insert plot before index

Parameters:
remove_plot(plot)[source]

Remove a plot from the file.

Deprecated since version 0.8: Use Plots.remove() instead.

Parameters:plot (openmc.Plot) – Plot to remove