From: Eric F. <ef...@ha...> - 2012-06-15 01:58:18
|
On 06/14/2012 02:39 PM, Peter Würtz wrote: > > > > Benjamin Root-2 wrote: >> >> On Wed, Jun 13, 2012 at 10:46 AM, Peter Würtz >> <pw...@go...>wrote: >> >>> import matplotlib >>> import pylab as p >>> >>> p.plot([1,2,3]) >>> p.xticks([1],["tick"]) >>> ax = p.gca() >>> fig = p.gcf() >>> >>> p.draw() >>> def print_texts(artist): >>> for t in artist.findobj(matplotlib.text.Text): >>> if t.get_visible() and t.get_text(): >>> print " %s @ %s" % (t.get_text(), t.get_position()) >>> >>> print "X-Axis" >>> print_texts(ax.xaxis) >> >> This is my output using v1.1.1-rc2 >> >> X-Axis >> tick @ (1.0, 0.0) >> tick @ (0.0, 1.0) >> >> Strange indeed. >> >> > > So, it is a bug then? Doesn't look like a feature to me :) The reason it is happening is that Tick is a complicated beast, and it always includes two Text objects, whether they are needed or not. Whether they are drawn is controlled by the attributes 'label1On' and 'label2On', not by the standard Artist.get_visible(). I don't see any reason offhand why it couldn't be modified to use get_visible(). Eric |