enthought / enthought/mayavi

`mlab.orientation_axes` - Cannot set different properties for each individual axis

Open
#750 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.4k
Forks
316
Avg merge
7h 44m
Merged PRs (30d)
5

Description

### Issue description
Currently, MayaVI handles the three different captions as the same entity, which prevents setting their properties individually. This portion of code causes the issue:
https://github.com/enthought/mayavi/blob/226189a6ad3dc3c01d031ef21d0d0cde554ac851/mayavi/modules/orientation_axes.py#L159-L162

### How to reproduce?
Execute the following:
```python
from mayavi import mlab

#Display something..
mlab.points3d([0], [0], [0])

#Add an orientation axes
orientation_axes = mlab.orientation_axes()
orientation_axes.marker.interactive = False
orientation_axes.marker.set_viewport(0.0, 0.0, 0.5, 0.5)
orientation_axes.axes.normalized_label_position = [1.5, 1.5, 1.5]

#Setup color for each axis
orientation_axes.axes.x_axis_caption_actor2d.caption_text_property.color = (1, 0, 0)
orientation_axes.axes.y_axis_caption_actor2d.caption_text_property.color = (0, 1, 0)
orientation_axes.axes.z_axis_caption_actor2d.caption_text_property.color = (0, 0, 1)

mlab.show()
```

Expected:
![expected](https://user-images.githubusercontent.com/42140441/50677948-d429bd00-103f-11e9-927f-adc6b0416ffa.png)

Actual:
![actual](https://user-images.githubusercontent.com/42140441/50677949-d429bd00-103f-11e9-9e45-49aa98591aa1.png)

### Suggested solution
- Provide a flag such as `uniform_update` to update all properties uniformly at once (`uniform_update=True` by default for backwards compatibility)
- Store the full list of `caption_text_property` for the thee axes, and iterate over them to update, given that `uniform_update` is set
- If `uniform_update` is unset, `text_property` should not be accessible, and instead a list of `text_properties` shall be provided (e.g. `orientation_axes.text_properties[0].color` for the color of x axis). Alternatively, three separated attributes `*_axis_text_property` can be provided.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.