Revision: 7213
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7213&view=rev
Author: jdh2358
Date: 2009-06-12 19:41:58 +0000 (Fri, 12 Jun 2009)
Log Message:
-----------
readded the long lost IndexFormatter
Modified Paths:
--------------
trunk/matplotlib/examples/pylab_examples/manual_axis.py
trunk/matplotlib/lib/matplotlib/ticker.py
Modified: trunk/matplotlib/examples/pylab_examples/manual_axis.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/manual_axis.py 2009-06-12
13:46:48 UTC (rev 7212)
+++ trunk/matplotlib/examples/pylab_examples/manual_axis.py 2009-06-12
19:41:58 UTC (rev 7213)
@@ -1,10 +1,11 @@
"""
-matplotlib is fairly rigid about how and where it draws it xaxis and
-yaxis, and it is a frequent request to be able to place these in other
-locations. While it is not possible to customize matplotlib's
-internal axis objects in this way, it is not too hard to simply turn
-them off and draw your own axis lines, tick lines, and tick labels
-where and how you want them
+The techniques here are no longer required with the new support for
+spines in matplotlib -- see
+http://matplotlib.sourceforge.net/examples/pylab_examples/spine_placement_demo.html.
+
+This example should be considered deprecated and is left just for demo
+purposes for folks wanting to make a pseudo-axis
+
"""
import numpy as np
Modified: trunk/matplotlib/lib/matplotlib/ticker.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/ticker.py 2009-06-12 13:46:48 UTC (rev
7212)
+++ trunk/matplotlib/lib/matplotlib/ticker.py 2009-06-12 19:41:58 UTC (rev
7213)
@@ -80,6 +80,9 @@
:class:`NullFormatter`
no labels on the ticks
+:class:`IndexFormatter`
+ set the strings from a list of labels
+
:class:`FixedFormatter`
set the strings manually for the labels
@@ -203,6 +206,24 @@
"""
return s
+class IndexFormatter:
+ """
+ format the position x to the nearest i-th label where i=int(x+0.5)
+ """
+ def __init__(self, labels):
+ self.labels = labels
+ self.n = len(labels)
+ def __call__(self, x, pos=None):
+ 'Return the format for tick val x at position pos; pos=None indicated
unspecified'
+ i = int(x+0.5)
+ if i<0:
+ return ''
+ elif i>=self.n:
+ return ''
+ else:
+ return self.labels[i]
+
+
class NullFormatter(Formatter):
'Always return the empty string'
def __call__(self, x, pos=None):
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins