From 14978617149b2bbf00338a4a5d734501c5cf5a6a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20Wobst?= Date: Wed, 19 Nov 2008 17:01:15 +0000 Subject: [PATCH] properly rotate axis titles when ticks are not othorgonal to the axis (reported by Christian Delfosse) git-svn-id: https://pyx.svn.sourceforge.net/svnroot/pyx/trunk/pyx@3002 069f4177-920e-0410-937b-c2a4a81bcd90 --- CHANGES | 2 ++ pyx/graph/axis/painter.py | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 6f6e6801..a277a749 100644 --- a/CHANGES +++ b/CHANGES @@ -112,6 +112,8 @@ TODO: - dokeyitem method (to be called with a plotitem) to alter the key order - doplot() was renamed to doplotitem(), dodata() was renamed to doplot() to have similar naming conventions like for the graph key + - axis painter: properly rotate axis titles when ticks are not othorgonal + to the axis (reported by Christian Delfosse) - canvas and document modules: - auto-guess output filename from the script filename - add ciecolor flag and input type to the pipeGS method of canvas diff --git a/pyx/graph/axis/painter.py b/pyx/graph/axis/painter.py index 2391e1bb..dbc4ccc5 100644 --- a/pyx/graph/axis/painter.py +++ b/pyx/graph/axis/painter.py @@ -100,7 +100,12 @@ class _title(_text): dx, dy = axispos.vtickdirection(self.titlepos) titleattrs = self.defaulttitleattrs + self.titleattrs if self.titledirection is not None: - titleattrs.append(self.titledirection.trafo(dx, dy)) + x2, y2 = axispos.vtickpoint_pt(self.titlepos+0.001) # XXX: axisdirection needed + dx2, dy2 = x2-x, y2-y + if dx*dy2-dy*dx2 < 0: + dy2 *= -1 + dx2 *= -1 + titleattrs.append(self.titledirection.trafo(dy2, -dx2)) title = canvas.text_pt(x, y, axis.title, titleattrs) canvas.extent_pt += unit.topt(self.titledist) title.linealign_pt(canvas.extent_pt, -dx, -dy) -- 2.11.4.GIT