# Voxel coloring

**URL:** <https://openmc.discourse.group/t/voxel-coloring/504>\
**Category:** User Support\
**Created:** [October 28, 2019, 4:44pm UTC](https://openmc.discourse.group/t/voxel-coloring/504 "2019-10-28T16:44:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![shaikinast](https://avatars.discourse-cdn.com/v4/letter/s/a3d4f5/32.png) [@shaikinast](https://openmc.discourse.group/u/shaikinast)\
**Post date:** [October 28, 2019, 4:44pm UTC](https://openmc.discourse.group/t/voxel-coloring/504/1 "2019-10-28T16:44:33Z")

</div>

Hi,

I am making a voxel plot, and I’m trying to color the elements by their material.

When I produce the hdf file of the 3D-plot, I get a warning:

“WARNING: Color specifications ignored in voxel plot 2”

When I open the converted VTK file in ParaView, the colormap refers to **cell id**.

Is there a way to:

1. Refer the colormap to **material id** instead?
2. Export the colormap from OpenMC to the hdf file?

Thanks,  
Shai

---

<div class="post-metadata">

**Author:** ![paulromano](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/paulromano/32/486_2.png) [@paulromano](https://openmc.discourse.group/u/paulromano)\
**Post date:** [October 29, 2019, 1:42am UTC](https://openmc.discourse.group/t/voxel-coloring/504/2 "2019-10-29T01:42:51Z")

</div>

If you set:

p = openmc.Plot()  
p.color\_by = ‘material’  
…

that will change it to color the plot by materials rather than cells.

Best,  
Paul

---

<div class="post-metadata">

**Author:** ![shaikinast](https://avatars.discourse-cdn.com/v4/letter/s/a3d4f5/32.png) [@shaikinast](https://openmc.discourse.group/u/shaikinast)\
**Post date:** [October 29, 2019, 1:54am UTC](https://openmc.discourse.group/t/voxel-coloring/504/3 "2019-10-29T01:54:17Z")

</div>

Hi Paul,

Thanks for your reply.  
The color\_by function works fine in 2D plotting.  
However, in 3D plotting this doesn’t seem to work.

Thanks,  
Shai

---

<div class="post-metadata">

**Author:** ![paulromano](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/paulromano/32/486_2.png) [@paulromano](https://openmc.discourse.group/u/paulromano)\
**Post date:** [October 29, 2019, 2:46am UTC](https://openmc.discourse.group/t/voxel-coloring/504/4 "2019-10-29T02:46:30Z")

</div>

Yes, it appears you’re correct. Unfortunately that means there’s nothing you can do to get the material IDs at present. However, I’ve just submitted a [bugfix](https://github.com/openmc-dev/openmc/pull/1388) that will allow the color\_by option to work for voxel plots, so that should be part of the next version.

Best,  
Paul

---

<div class="post-metadata">

**Author:** ![shaikinast](https://avatars.discourse-cdn.com/v4/letter/s/a3d4f5/32.png) [@shaikinast](https://openmc.discourse.group/u/shaikinast)\
**Post date:** [October 29, 2019, 3:35am UTC](https://openmc.discourse.group/t/voxel-coloring/504/5 "2019-10-29T03:35:17Z")

</div>

Thank you very much!
