From: <md...@us...> - 2010-06-11 18:17:59
|
Revision: 8415 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8415&view=rev Author: mdboom Date: 2010-06-11 18:17:52 +0000 (Fri, 11 Jun 2010) Log Message: ----------- Add a global rcParam 'path.snap' that, when False, turns off all pixel-snapping. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/artist.py trunk/matplotlib/lib/matplotlib/collections.py trunk/matplotlib/lib/matplotlib/config/mplconfig.py trunk/matplotlib/lib/matplotlib/config/rcsetup.py trunk/matplotlib/lib/matplotlib/patches.py trunk/matplotlib/lib/matplotlib/rcsetup.py trunk/matplotlib/matplotlibrc.template Modified: trunk/matplotlib/lib/matplotlib/artist.py =================================================================== --- trunk/matplotlib/lib/matplotlib/artist.py 2010-06-11 14:30:32 UTC (rev 8414) +++ trunk/matplotlib/lib/matplotlib/artist.py 2010-06-11 18:17:52 UTC (rev 8415) @@ -2,7 +2,7 @@ import re, warnings import matplotlib import matplotlib.cbook as cbook -from matplotlib import docstring +from matplotlib import docstring, rcParams from transforms import Bbox, IdentityTransform, TransformedBbox, TransformedPath from path import Path @@ -414,7 +414,10 @@ Only supported by the Agg and MacOSX backends. """ - return self._snap + if rcParams['path.snap']: + return self._snap + else: + return False def set_snap(self, snap): """ Modified: trunk/matplotlib/lib/matplotlib/collections.py =================================================================== --- trunk/matplotlib/lib/matplotlib/collections.py 2010-06-11 14:30:32 UTC (rev 8414) +++ trunk/matplotlib/lib/matplotlib/collections.py 2010-06-11 18:17:52 UTC (rev 8415) @@ -211,6 +211,7 @@ gc = renderer.new_gc() self._set_gc_clip(gc) + gc.set_snap(self.get_snap()) renderer.draw_path_collection( gc, transform.frozen(), paths, self.get_transforms(), Modified: trunk/matplotlib/lib/matplotlib/config/mplconfig.py =================================================================== --- trunk/matplotlib/lib/matplotlib/config/mplconfig.py 2010-06-11 14:30:32 UTC (rev 8414) +++ trunk/matplotlib/lib/matplotlib/config/mplconfig.py 2010-06-11 18:17:52 UTC (rev 8415) @@ -118,6 +118,7 @@ class path(TConfig): simplify = T.false simplify_threshold = T.float(1.0 / 9.0) + snap = T.true class patch(TConfig): linewidth = T.Float(1.0) @@ -444,7 +445,8 @@ # Path properties 'path.simplify' : (self.tconfig.path, 'simplify'), - 'path.simplify_threshold' : (self.tconfig.path, 'simplify_threshold') + 'path.simplify_threshold' : (self.tconfig.path, 'simplify_threshold'), + 'path.snap' : (self.tconfig.path, 'snap') } def __setitem__(self, key, val): Modified: trunk/matplotlib/lib/matplotlib/config/rcsetup.py =================================================================== --- trunk/matplotlib/lib/matplotlib/config/rcsetup.py 2010-06-11 14:30:32 UTC (rev 8414) +++ trunk/matplotlib/lib/matplotlib/config/rcsetup.py 2010-06-11 18:17:52 UTC (rev 8415) @@ -476,7 +476,8 @@ 'plugins.directory' : ['.matplotlib_plugins', str], # where plugin directory is locate 'path.simplify' : [True, validate_bool], - 'path.simplify_threshold' : [1.0 / 9.0, ValidateInterval(0.0, 1.0)] + 'path.simplify_threshold' : [1.0 / 9.0, ValidateInterval(0.0, 1.0)], + 'path.snap' : [True, validate_bool] } if __name__ == '__main__': Modified: trunk/matplotlib/lib/matplotlib/patches.py =================================================================== --- trunk/matplotlib/lib/matplotlib/patches.py 2010-06-11 14:30:32 UTC (rev 8414) +++ trunk/matplotlib/lib/matplotlib/patches.py 2010-06-11 18:17:52 UTC (rev 8415) @@ -356,7 +356,7 @@ self._set_gc_clip(gc) gc.set_capstyle('projecting') gc.set_url(self._url) - gc.set_snap(self._snap) + gc.set_snap(self.get_snap()) if (not self.fill or self._facecolor is None or (cbook.is_string_like(self._facecolor) and self._facecolor.lower()=='none')): @@ -3845,6 +3845,7 @@ gc.set_antialiased(self._antialiased) self._set_gc_clip(gc) gc.set_capstyle('round') + gc.set_snap(self.get_snap()) if (not self.fill or self._facecolor is None or (cbook.is_string_like(self._facecolor) and self._facecolor.lower()=='none')): Modified: trunk/matplotlib/lib/matplotlib/rcsetup.py =================================================================== --- trunk/matplotlib/lib/matplotlib/rcsetup.py 2010-06-11 14:30:32 UTC (rev 8414) +++ trunk/matplotlib/lib/matplotlib/rcsetup.py 2010-06-11 18:17:52 UTC (rev 8415) @@ -546,16 +546,17 @@ 'path.simplify' : [True, validate_bool], 'path.simplify_threshold' : [1.0 / 9.0, ValidateInterval(0.0, 1.0)], + 'path.snap' : [True, validate_bool], 'agg.path.chunksize' : [0, validate_int], # 0 to disable chunking; # recommend about 20000 to # enable. Experimental. # key-mappings - 'keymap.fullscreen' : ['f', validate_stringlist], + 'keymap.fullscreen' : ['f', validate_stringlist], 'keymap.home' : [['h', 'r', 'home'], validate_stringlist], 'keymap.back' : [['left', 'c', 'backspace'], validate_stringlist], 'keymap.forward' : [['right', 'v'], validate_stringlist], 'keymap.pan' : ['p', validate_stringlist], - 'keymap.zoom' : ['o', validate_stringlist], + 'keymap.zoom' : ['o', validate_stringlist], 'keymap.save' : ['s', validate_stringlist], 'keymap.grid' : ['g', validate_stringlist], 'keymap.yscale' : ['l', validate_stringlist], Modified: trunk/matplotlib/matplotlibrc.template =================================================================== --- trunk/matplotlib/matplotlibrc.template 2010-06-11 14:30:32 UTC (rev 8414) +++ trunk/matplotlib/matplotlibrc.template 2010-06-11 18:17:52 UTC (rev 8415) @@ -63,10 +63,10 @@ # circles. See # http://matplotlib.sourceforge.net/api/artist_api.html#module-matplotlib.patches # information on patch properties -#patch.linewidth : 1.0 # edge width in points -#patch.facecolor : blue -#patch.edgecolor : black -#patch.antialiased : True # render patches in antialised (no jaggies) +#patch.linewidth : 1.0 # edge width in points +#patch.facecolor : blue +#patch.edgecolor : black +#patch.antialiased : True # render patches in antialised (no jaggies) ### FONT # @@ -268,12 +268,12 @@ # The figure subplot parameters. All dimensions are fraction of the # figure width or height -#figure.subplot.left : 0.125 # the left side of the subplots of the figure -#figure.subplot.right : 0.9 # the right side of the subplots of the figure -#figure.subplot.bottom : 0.1 # the bottom of the subplots of the figure -#figure.subplot.top : 0.9 # the top of the subplots of the figure -#figure.subplot.wspace : 0.2 # the amount of width reserved for blank space between subplots -#figure.subplot.hspace : 0.2 # the amount of height reserved for white space between subplots +#figure.subplot.left : 0.125 # the left side of the subplots of the figure +#figure.subplot.right : 0.9 # the right side of the subplots of the figure +#figure.subplot.bottom : 0.1 # the bottom of the subplots of the figure +#figure.subplot.top : 0.9 # the top of the subplots of the figure +#figure.subplot.wspace : 0.2 # the amount of width reserved for blank space between subplots +#figure.subplot.hspace : 0.2 # the amount of height reserved for white space between subplots ### IMAGES #image.aspect : equal # equal | auto | a number @@ -297,12 +297,15 @@ # A value of 20000 is probably a good # starting point. ### SAVING FIGURES -#path.simplify : False # When True, simplify paths by removing "invisible" +#path.simplify : True # When True, simplify paths by removing "invisible" # points to reduce file size and increase rendering # speed #path.simplify_threshold : 0.1 # The threshold of similarity below which # vertices will be removed in the simplification # process +#path.snap : True # When True, rectilinear axis-aligned paths will be snapped to + # the nearest pixel when certain criteria are met. When False, + # paths will never be snapped. # the default savefig params can be different from the display params # Eg, you may want a higher resolution, or to make the figure @@ -362,12 +365,12 @@ #verbose.fileo : sys.stdout # a log filename, sys.stdout or sys.stderr # Event keys to interact with figures/plots via keyboard. -# Customize these settings according to your needs. -# Leave the field(s) empty if you don't need a key-map. (i.e., fullscreen : '') +# Customize these settings according to your needs. +# Leave the field(s) empty if you don't need a key-map. (i.e., fullscreen : '') -#keymap.fullscreen : f # toggling +#keymap.fullscreen : f # toggling #keymap.home : h, r, home # home or reset mnemonic -#keymap.back : left, c, backspace # forward / backward keys to enable +#keymap.back : left, c, backspace # forward / backward keys to enable #keymap.forward : right, v # left handed quick navigation #keymap.pan : p # pan mnemonic #keymap.zoom : o # zoom mnemonic This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |