enthought / enthought/chaco

PlotAxis does not rotate ticks if TickGenerator has a method called `get_ticks_and_labels`

Open
#294 1 comment 0 reactions 0 assignees View on GitHub
type: bug
Dominant language
Python
Stars
305
Forks
97
PR merge metrics
No merged PRs in 30d

Description

The `PlotAxis` has got special code for tick generators that can return both the tick position and the tick label. That path does not respect the `tick_label_rotate_angle` and `tick_label_margin` parameters of `PlotAxis`.

This is a patch that worked around the problem in a project:

```
from chaco.api import PlotAxis

class PatchedPlotAxis(PlotAxis):
"""
Patched version of PlotAxis.

Fixes a bug where the ticks labels are not rotated when the ticks
generator has a method called ``get_ticks_and_labels``.
"""

def _compute_labels(self, gc):
if hasattr(self.tick_generator, "get_ticks_and_labels"):
for label in self.ticklabel_cache:
label.rotate_angle = self.tick_label_rotate_angle
label.margin = self.tick_label_margin
super(PatchedPlotAxis, self)._compute_labels(gc)
```

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.