# Plotting more than one cloned cell at the same time

**URL:** <https://openmc.discourse.group/t/plotting-more-than-one-cloned-cell-at-the-same-time/5080>\
**Category:** User Support\
**Created:** [December 23, 2024, 10:16pm UTC](https://openmc.discourse.group/t/plotting-more-than-one-cloned-cell-at-the-same-time/5080 "2024-12-23T22:16:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rherrero-pf](https://avatars.discourse-cdn.com/v4/letter/r/3d9bf3/32.png) [@rherrero-pf](https://openmc.discourse.group/u/rherrero-pf)\
**Post date:** [December 23, 2024, 10:16pm UTC](https://openmc.discourse.group/t/plotting-more-than-one-cloned-cell-at-the-same-time/5080/1 "2024-12-23T22:16:43Z")

</div>

Hello, I’m trying to understand the behavior of cloning and rotating. In this simple example I can only visualize the original cell, and the first rotated cell at most. Ideally I would like to see all cells together in one plot. Any help would be much appreciated!

 ![image](https://global.discourse-cdn.com/free1/uploads/openmc/original/2X/d/d4a4bb34c9930edaa11d85778b3704391246d14a.png)

```auto
import openmc
import matplotlib.pyplot as plt

spheres = []

sphere_surface = openmc.Sphere(x0=5.0, y0=0, z0=0, r=1.0)

sphere_region = - sphere_surface
sphere_cell = openmc.Cell(region=sphere_region)
spheres.append(sphere_cell)

cloned_sphere = sphere_cell.clone()
universe = openmc.Universe(cells=[cloned_sphere])

rotated_sphere_1 = openmc.Cell(fill=universe)
rotated_sphere_1.rotation = [0, 0, 90]
spheres.append(rotated_sphere_1)

cloned_sphere = sphere_cell.clone()
universe = openmc.Universe(cells=[cloned_sphere])

rotated_sphere_2 = openmc.Cell(fill=universe)
rotated_sphere_2.rotation = [0, 0, 180]
spheres.append(rotated_sphere_2)

print(spheres)

geometry = openmc.Geometry(root=spheres)
geometry.plot(
    basis='xy', 
    origin=[0,0,0],
    width=[20, 20],
    pixels=[1000, 1000], 
)
plt.show()

```

If I print the cells, this how they look like:

```auto
[Cell
        ID = 1
        Name =
        Fill = None
        Region = -1
        Rotation = None
        Translation = None
        Volume = None
, Cell
        ID = 3
        Name =
        Fill = 1
        Region = None
        Rotation = [0 0 90]
        Translation = None
        Volume = None
, Cell
        ID = 5
        Name =
        Fill = 2
        Region = None
        Rotation = [0 0 180]
        Translation = None
        Volume = None
]

```

---

<div class="post-metadata">

**Author:** ![Shimwell](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/shimwell/32/3876_2.png) [@Shimwell](https://openmc.discourse.group/u/Shimwell)\
**Post date:** [December 24, 2024, 7:54pm UTC](https://openmc.discourse.group/t/plotting-more-than-one-cloned-cell-at-the-same-time/5080/2 "2024-12-24T19:54:27Z")

</div>

oh I think this might be a small bug in OpenMC

Adding `geometry.export_to_xml()` the xml file produced has this code

```auto
<?xml version='1.0' encoding='UTF-8'?>
<geometry>
  <cell id="1" material="void" region="-1" universe="1"/>
  <cell id="2" material="void" region="-2" universe="2"/>
  <cell fill="2" id="3" rotation="0 0 90" universe="1"/>
  <cell id="4" material="void" region="-3" universe="3"/>
  <cell fill="3" id="5" rotation="0 0 180" universe="1"/> ****** this line appears to use the wrong universe
  <surface coeffs="5.0 0 0 1.0" id="1" type="sphere"/>
  <surface coeffs="5.0 0 0 1.0" id="2" type="sphere"/>
  <surface coeffs="5.0 0 0 1.0" id="3" type="sphere"/>
</geometry>

```

changing this line manually from

```auto
 <cell fill="3" id="5" rotation="0 0 180" universe="1"/>

```

to

```auto
 <cell fill="3" id="5" rotation="0 0 180" universe="2"/>

```

Then reading the xml back in and potting produces the desired rotations

 ![Screenshot from 2024-12-24 20-51-43](https://global.discourse-cdn.com/free1/uploads/openmc/original/2X/2/2d83b30ce2f1d8fd5f5c415060d19593284561e3.png)
