markers going over frame + non-negative axes numbers
Closed this issue · 4 comments
pywcsgrid2 is amazing and is vastly improving the quality of the figures in my upcomming publication.
But I am having two minor issues to report. I can reproduce both of them with a very simple selfcontained script.
The first problem is that the axes label for b=-0.5 degrees is displayed as 0°30' when it should be -0°30'.
The second issue is that when markers have a zorder>2, they will spill over the axes.
Thanks,
import numpy, pyfits, pywcsgrid2, pylab
values = [
["NAXIS", 2, ],
["NAXIS1", 25, ],
["NAXIS2", 25, ],
["CTYPE1", 'GLON-ZEA' ],
["CRPIX1", -12.5, ],
["CRVAL1", 0, ],
["CDELT1", -0.1, ],
["CTYPE2", 'GLAT-ZEA', ],
["CRPIX2", 12.5, ],
["CRVAL2", 0, ],
["CDELT2", 0.1, ],
]
cards = [ pyfits.Card(*i) for i in values]
header=pyfits.Header(cards=cards)
ax=pywcsgrid2.subplot(111, header=header)
array=numpy.meshgrid(range(25),range(25))[0]
ax.imshow(array,origin='lower')
ax['gal'].plot([358.7],[-0.5],'*',ms=50,
color='none',mec='w',zorder=10,
mew=10)
pylab.savefig('plot.pdf')
Thanks for reporting the problem and I'll look into it.
For the second problem, can you be more specific about what you mean? What I see is that the markers are placed on top of the bounding lines of axes. This is expected since the zorder of those bounding lines are 2.5 by default.
You may limit the zorder of your plots under 2.5 (zorder can be any float number), or you can increase the zorder of bounding lines.
ax.axis[:].set_zorder(100)
I can reproduce the first problem and I'll take a look soon.
Regards,
The first problem is turned out to be a bug in axisartist module in matplotlib (pywcsgrid2 is heavily based on axisartist module). I just pushed a commit that fixes this problem.
And this requires you to install matplotlib from github source. I'm working on a workaround which will do monkey-patching the matploblib when pywcsgrid2 is imported, but I'm not sure if this is a good approach.
Hi. I am the OP, but forgot to save the password for my old account.
Thank you so much for your help. I totally love pywcsgrid2.
Regarding issue (1), thanks for the fix. Personally, I find it weird that anything could ever come in front of the frame, but I am happy to use your work around if this is supposed to be the default behavior.
Regarding issue (2), thanks for the fix. I am happy to install matplotlib from source. As a work around, I anyway just used absolute degrees. So if I were you I would not waste any time on a convoluted monkey-patch.
(1) The behavior was inherited from the Matplotlib. And I think this is reasonable; e.g., legends have default zorder of 5
http://matplotlib.sourceforge.net/examples/pylab_examples/legend_demo3.html
(2) Okay. I won't push the monkey-patching.
I'm closing this issue assuming that the fix of the matplolib works. Let me know if there is any problem.