diff --git a/OpenPNM/Graphics.py b/OpenPNM/Graphics.py
index <HASH>..<HASH> 100644
--- a/OpenPNM/Graphics.py
+++ b/OpenPNM/Graphics.py
@@ -1,5 +1,7 @@
+import numpy as np
+import vtk
+
 def preview(pn, values=[]):
-    import vtk
 
     coords = pn.get_pore_data(prop='coords')
     heads, tails = pn.get_throat_data(prop='connections').T
@@ -17,6 +19,10 @@ def preview(pn, values=[]):
 
     colors = vtk.vtkUnsignedCharArray()
     colors.SetNumberOfComponents(3)
+    if any(values):
+        values = np.array(values)
+        values -= values.min()
+        values = np.true_divide(values, values.max())
     for v in values:
         r = 255*(v)
         g = 0
@@ -28,7 +34,7 @@ def preview(pn, values=[]):
     polydata.SetLines(polys)
     if colors.GetNumberOfTuples() == len(coords):
         polydata.GetPointData().SetScalars(colors)
-    else:
+    elif colors.GetNumberOfTuples() != 0:
         raise Exception("Mismatch: {} points, {} scalars".format(
                         len(coords), colors.GetNumberOfTuples()))
True divide in array normalization. Integer inputs were getting zeroed out.


Former-commit-id: dc3c<I>ef0c6c<I>ba<I>d5ea7be3a<I>b<I>c<I>
Former-commit-id: bfb<I>edc<I>c<I>b<I>a<I>a7d<I>f<I>