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()

plots (Iterable of openmc.Plot) – Plots to add to the collection


Append plot to collection


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”.

  • geometry (openmc.Geometry) – The geometry for which the plots are defined

  • seed (Integral) – The random number seed used to generate the color scheme


Export plot specifications to an XML file.


path (str) – Path to file to write. Defaults to ‘plots.xml’.

classmethod from_xml(path='plots.xml')[source]

Generate plots collection from XML file


path (str, optional) – Path to plots XML file


Plots collection

Return type


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.

  • geometry (openmc.Geometry) – The geometry for which the plot is defined

  • domains (Iterable of openmc.Cell or openmc.Material) – A collection of the domain IDs to highlight in the plot

  • seed (int) – The random number seed used to generate the color scheme

  • alpha (float) – The value between 0 and 1 to apply in alpha compositing

  • background (3-tuple of int or str) – The background color to apply in alpha compositing

insert(index, plot)[source]

Insert plot before index