Re: [Matplotlib-users] Axis ticks 'zorder'
Hi, 2012/7/30 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! > > ### 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
[Matplotlib-users] Axis ticks 'zorder'
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] Bug in colorbar()
I'd agree as then it would work as pcolormesh or imshow does which when passed in the same norm will only set vmin or vmax that wasn't previously set. Assume this would be a really easy fix but I can have a look at submitting a patch if someone else isn't going to do so just let me know. Cheers, Jeff On Mon, Jul 30, 2012 at 2:31 AM, Eric Firing wrote: > On 2012/07/29 5:13 AM, Jeffrey Spencer wrote: > >> Eric, >> >> Normalize appears to be working correctly and as you stated above but >> when passed into contourf appears to have inconsistent results not >> following the docstring by allowing the value to change. >> >> Quick examples: >> >> X, Y = meshgrid(arange(20),arange(20)**) >> Z = arange(20*20) >> Z = Z.reshape(20,20) >> norm = colors.Normalize(vmin=200,**vmax=None) >> print norm.vmin >> fig = figure(10) >> ax = fig.add_subplot(111) >> surf = ax.contourf(X,Y,Z, 100, cmap=matplotlib.cm.jet, norm = norm) >> >> This vmin has no effect where if you pass in: >> >> X, Y = meshgrid(arange(20),arange(20)**) >> Z = arange(20*20) >> Z = Z.reshape(20,20) >> norm = colors.Normalize(vmin=200,**vmax=Z.max()) >> print norm.vmin >> fig = figure(10) >> ax = fig.add_subplot(111) >> surf = ax.contourf(X,Y,Z, 100, cmap=matplotlib.cm.jet, norm = norm) >> >> it has the desired effect. >> >> Let me know if this is correct or I'm missing something here. >> >> Cheers, >> Jeff >> > > You are correct. Contour and contourf are respecting vmin, vmax that have > been set in the norm only if both have been set, so that it is fully > scaled. I think that changing this to respect a single preset vmin or vmax > would be reasonable. > > Eric > > -- 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] How to determine position of axes after imshow?
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