Repository: yt-project/yt

Issue:
Colors for scene.annotate_axes() are wrong
<!--To help us understand and resolve your issue, please fill out the form to
the best of your ability.-->
<!--You can feel free to delete the sections that do not apply.-->

### Bug report

**Bug summary**

The colors for the annotate_axes volume rendering annotation are wrong.

<!--A short 1-2 sentences that succinctly describes the bug-->

**Code for reproduction**

<!--A minimum code snippet required to reproduce the bug, also minimizing the
number of dependencies required.-->

<!-- If you need to use a data file to trigger the issue you're having, consider
using one of the datasets from the yt data hub (http://yt-project.org/data). If
your issue cannot be triggered using a public dataset, you can use the yt
curldrop (https://docs.hub.yt/services.html#curldrop) to share data
files. Please include a link to the dataset in the issue if you use the
curldrop.-->

```python
import yt
from yt.testing import fake_vr_orientation_test_ds
ds = fake_vr_orientation_test_ds()
sc = yt.create_scene(ds)
sc.annotate_axes()
sc.save()
```

**Actual outcome**

<!--The output produced by the above code, which may be a screenshot, console
output, etc.-->

![uniformgriddata_render_density](https://user-images.githubusercontent.com/3126246/32052667-61992d96-ba2f-11e7-9351-ec08aff5d720.png)


**Expected outcome**

<!--A description of the expected outcome from the code snippet-->
<!--If this used to work in an earlier version of yt, please note the
version it used to work on-->

The coordinate triad should have a red, green, and blue line instead of two red lines and a green one.

**Version Information**
<!--Please specify your platform and versions of the relevant libraries you are
using:-->
  * Operating System: MacOS
  * Python Version: 3.6
  * yt version: latest development version
  * Other Libraries (if applicable): 

<!--Please tell us how you installed yt and python e.g., from source,
pip, conda. If you installed from conda, please specify which channel you used
if not the default-->


Colors for scene.annotate_axes() are wrong
<!--To help us understand and resolve your issue, please fill out the form to
the best of your ability.-->
<!--You can feel free to delete the sections that do not apply.-->

### Bug report

**Bug summary**

The colors for the annotate_axes volume rendering annotation are wrong.

<!--A short 1-2 sentences that succinctly describes the bug-->

**Code for reproduction**

<!--A minimum code snippet required to reproduce the bug, also minimizing the
number of dependencies required.-->

<!-- If you need to use a data file to trigger the issue you're having, consider
using one of the datasets from the yt data hub (http://yt-project.org/data). If
your issue cannot be triggered using a public dataset, you can use the yt
curldrop (https://docs.hub.yt/services.html#curldrop) to share data
files. Please include a link to the dataset in the issue if you use the
curldrop.-->

```python
import yt
from yt.testing import fake_vr_orientation_test_ds
ds = fake_vr_orientation_test_ds()
sc = yt.create_scene(ds)
sc.annotate_axes()
sc.save()
```

**Actual outcome**

<!--The output produced by the above code, which may be a screenshot, console
output, etc.-->

![uniformgriddata_render_density](https://user-images.githubusercontent.com/3126246/32052667-61992d96-ba2f-11e7-9351-ec08aff5d720.png)


**Expected outcome**

<!--A description of the expected outcome from the code snippet-->
<!--If this used to work in an earlier version of yt, please note the
version it used to work on-->

The coordinate triad should have a red, green, and blue line instead of two red lines and a green one.

**Version Information**
<!--Please specify your platform and versions of the relevant libraries you are
using:-->
  * Operating System: MacOS
  * Python Version: 3.6
  * yt version: latest development version
  * Other Libraries (if applicable): 

<!--Please tell us how you installed yt and python e.g., from source,
pip, conda. If you installed from conda, please specify which channel you used
if not the default-->




Discussion:

Resolving patch:
diff --git a/yt/visualization/volume_rendering/render_source.py b/yt/visualization/volume_rendering/render_source.py
--- a/yt/visualization/volume_rendering/render_source.py
+++ b/yt/visualization/volume_rendering/render_source.py
@@ -1240,7 +1240,6 @@ def __init__(self, colors=None, alpha=1.0):
             colors[2, 2] = 1.0  # z is blue
             colors[:, 3] = alpha
         self.colors = colors
-        self.color_stride = 2
 
     def render(self, camera, zbuffer=None):
         """Renders an image using the provided camera
@@ -1321,15 +1320,14 @@ def render(self, camera, zbuffer=None):
         py = py.astype('int64')
 
         if len(px.shape) == 1:
-            zlines(empty, z, px, py, dz, self.colors.astype('float64'),
-                   self.color_stride)
+            zlines(empty, z, px, py, dz, self.colors.astype('float64'))
         else:
             # For stereo-lens, two sets of pos for each eye are contained
             # in px...pz
             zlines(empty, z, px[0, :], py[0, :], dz[0, :],
-                   self.colors.astype('float64'), self.color_stride)
+                   self.colors.astype('float64'))
             zlines(empty, z, px[1, :], py[1, :], dz[1, :],
-                   self.colors.astype('float64'), self.color_stride)
+                   self.colors.astype('float64'))
 
         # Set the new zbuffer
         self.zbuffer = zbuffer


Test patch:
diff --git a/yt/visualization/volume_rendering/tests/test_scene.py b/yt/visualization/volume_rendering/tests/test_scene.py
--- a/yt/visualization/volume_rendering/tests/test_scene.py
+++ b/yt/visualization/volume_rendering/tests/test_scene.py
@@ -18,8 +18,12 @@
 import shutil
 from yt.testing import \
     fake_random_ds, \
-    assert_fname
-from yt.visualization.volume_rendering.api import volume_render, VolumeSource
+    assert_fname, \
+    fake_vr_orientation_test_ds
+from yt.visualization.volume_rendering.api import \
+    create_scene, \
+    volume_render, \
+    VolumeSource
 import numpy as np
 from unittest import TestCase
 
@@ -90,3 +94,15 @@ def test_rotation(self):
             sc.camera.pitch(2*np.pi/nrot)
             sc.render()
             sc.save('test_rot_%04i.png' % i, sigma_clip=6.0)
+
+def test_annotations():
+    ds = fake_vr_orientation_test_ds(N=16)
+    sc = create_scene(ds)
+    sc.annotate_axes()
+    sc.annotate_domain(ds)
+    sc.render()
+    # ensure that there are actually red, green, blue, and white pixels
+    # in the image. see Issue #1595
+    im = sc._last_render
+    for c in ([1, 0, 0, 1], [0, 1, 0, 1], [0, 0, 1, 1], [1, 1, 1, 1]):
+        assert np.where((im == c).all(axis=-1))[0].shape[0] > 0