On 06/11/2010 02:38 PM, jason-s...@creativetrax.com wrote: > On 6/11/10 1:02 PM, Michael Droettboom wrote: > >> >>> It appears that the difficulty is that quantization is exposed at the >>> python level only for collections, via iter_segments. >>> >>> >>> >> Sort of. Lines (but none of the other artists) follow what is set by >> "set_snap" (the use of two terms for the same thing is also a problem, >> of course). This needs to be extended to other artists (and other >> relevant backend methods other than draw_path, if necessary). But I >> think for convenience, it should also be a global rcParam. >> > I think a work-around, then (at least it seems to work for me), is > setting both snap to False and antialiased to False for the spines. > That won't solve the issue for other horizontal lines, but at least it > takes care of having the correct origin for the intersection of the > spines. (Correct me if I'm wrong, of course!) > > from matplotlib import pyplot as plt > import numpy as np > fig = plt.figure() > ax = fig.add_subplot(1,1,1, aspect='equal') > line1=ax.plot([-1,1],[0,0], color='blue') > line2=ax.plot([-1,1],[-1,1], color='red',zorder=5) > ax.set_xlim(-1.1,1.1) > ax.set_ylim(-1.1,1.1) > ax.spines['left'].set_position('zero') > ax.spines['left'].set_snap(False) > ax.spines['left'].set_antialiased(False) > ax.spines['right'].set_color('none') > ax.spines['bottom'].set_position('zero') > ax.spines['bottom'].set_snap(False) > ax.spines['bottom'].set_antialiased(False) > ax.spines['top'].set_color('none') > ax.xaxis.set_ticks_position('bottom') > ax.yaxis.set_ticks_position('left') > fig.savefig('test.png',dpi=100) > I've committed a patch that provides a global snap setting in r8415. Set the rcParam "path.snap" to False to turn off all snapping (though it should be equivalent to your "set_snap" calls above -- just possibly more convenient).
However, I think turning anti-aliasing off will give you the same problem at some scales, as anti-aliasing has basically the same effect as snapping: rounding to integral pixel values. Try an odd dpi such as "67" for example. Mike -- Michael Droettboom Science Software Branch Space Telescope Science Institute Baltimore, Maryland, USA ------------------------------------------------------------------------------ ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo _______________________________________________ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel