offset_copy is still available, but unfortunately doesn't work with the cookbook example because of a bug that was inadvertently introduced into matplotlib.
The bug is that offset_copy should have been defined as: def offset_copy(trans, fig=None, x=0.0, y=0.0, units='inches'): instead of: def offset_copy(trans, fig, x=0.0, y=0.0, units='inches'): That is, the "fig" argument was originally optional, and in July 2008 I accidentally was made it "required". This will be fixed in the next release of matplotlib -- in the meantime the workaround to get the Cookbook recipe to work is to call offset_copy like this: return offset_copy(ax.transData, None, x=x, y=y, units='dots') If that change doesn't fix the recipe for you, please send a full traceback of the error so we can diagnose the problem. (FWIW -- I don't have edit privileges for the cookbook page, or I would go in and fix this...) Cheers, Mike mikey wrote: > Hi there, > > Just wondering if anyone knows how to do a pixel offset in matplotlib? > > I've tried running the example in > http://www.scipy.org/Cookbook/Matplotlib/Transformations#line-58 but > it appears to have been trashed by changes to the api. The functions > in the no-offset_copy function version don't exist any more and their > replacements don't work the same way, and the offset_copy function is > not available. (At least I am assuming it is because of updates rather > then my copy of Matplotlib being out of date: 0.99.1.1) This is a very > useful function if you're doing discrete data plots like I am and you > want uniform clusters of points. > > Thanks for your time. > > Regards, > > > Mikey > > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users