[Matplotlib-users] How to determine position of axes after imshow?

2012-07-30 Thread Mark Bakker
Hello List,

I am trying to determine the position of the axes after an imshow and am
having problems.
I get a different answer on my Mac (the correct answer) than Windows (the
wrong answer).
I have a file called testimage.py with 5 lines:

from pylab import *
c = ones((10,20))
ax = imshow(c)
show()
print ax.get_axes().get_position()

I run this file from IPython.

On my Mac I get:
run testimage
Bbox(array([[ 0.125 ,  0.2417],
   [ 0.9   ,  0.7583]]))

On Windows I get (the wrong answer):
run testimage
Bbox(array([[ 0.125, 0.1 ],
   [0.9, 0.9 ]]))

Any thoughts? When I type the commands in at the IPython prompt it works
most of the time (on Windows), but it never works when running the file.
What in the world could be different?

mp version 1.1.0 on both systems.

Thanks for your help,

Mark
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Axis ticks 'zorder'

2012-07-30 Thread oc-spam65
Hello,

Can the 'zorder' of the ticks be set? This minimal example shows a 
hard-coded value of 2.5

This may come from file matplotlib/axes.py, function draw(). Can it 
be adjusted? Shall it be bug-reported?

###
import matplotlib.pyplot as pyplot

fig = pyplot.figure()
ax = fig.add_subplot(111)

ax.add_patch(pyplot.Rectangle((0,0), 1, 1, zorder=3))
ax.xaxis.set_zorder(4)
# Expected behavior: the ticks should be drawn after the Rectangle,
# because 4  3. They should therefore be visible.

pyplot.show()
# Problem: The ticks are hidden by the rectangle, contrary to the
# expected behavior.

print(ax.xaxis.get_zorder())
# Prints 2.5 instead of 4!

###

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Axis ticks 'zorder'

2012-07-30 Thread Francesco Montesano
Hi,

2012/7/30 oc-spam65 oc-spa...@laposte.net:
 Hello,

 Can the 'zorder' of the ticks be set? This minimal example shows a
 hard-coded value of 2.5

 This may come from file matplotlib/axes.py, function draw(). Can it
 be adjusted? Shall it be bug-reported?

 ###
 import matplotlib.pyplot as pyplot

 fig = pyplot.figure()
 ax = fig.add_subplot(111)

 ax.add_patch(pyplot.Rectangle((0,0), 1, 1, zorder=3))
 ax.xaxis.set_zorder(4)
 # Expected behavior: the ticks should be drawn after the Rectangle,
 # because 4  3. They should therefore be visible.

 pyplot.show()
 # Problem: The ticks are hidden by the rectangle, contrary to the
 # expected behavior.

 print(ax.xaxis.get_zorder())
 # Prints 2.5 instead of 4!

 ###

I confirm the bug on matplotlib v: 1.1.0, Kubuntu 11.04, Python 2.7.1+

 ax.xaxis.set_zorder(4)
 ax.xaxis.get_zorder()
 4
 plt.draw()
 ax.xaxis.get_zorder()

It seems that the call to draw or show sets the zorder to default,
instead of updating it.

@Mr Spam (can you sign your mail, please)
In one of my scripts managed to set zorder to the spines as, e.g.,
ax.spines['left'].set_zorder(101).
This puts the axis spine well on top, but ax.xaxis.set_zorder does
nothing. I've also found a method ax.tick_params,
that has a zorder keyword, but it does nothing too.

Cheers,
Francesco


 --
 Live Security Virtual Conference
 Exclusive live event will cover all the ways today's security and
 threat landscape has changed and how IT managers can respond. Discussions
 will include endpoint security, mobile security and the latest in malware
 threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users