1 2Changes for 0.50 3================ 4 5.. code-block:: text 6 7 * refactored Figure class so it is no longer backend dependent. 8 FigureCanvasBackend takes over the backend specific duties of the 9 Figure. matplotlib.backend_bases.FigureBase moved to 10 matplotlib.figure.Figure. 11 12 * backends must implement FigureCanvasBackend (the thing that 13 controls the figure and handles the events if any) and 14 FigureManagerBackend (wraps the canvas and the window for MATLAB 15 interface). FigureCanvasBase implements a backend switching 16 mechanism 17 18 * Figure is now an Artist (like everything else in the figure) and 19 is totally backend independent 20 21 * GDFONTPATH renamed to TTFPATH 22 23 * backend faceColor argument changed to rgbFace 24 25 * colormap stuff moved to colors.py 26 27 * arg_to_rgb in backend_bases moved to class ColorConverter in 28 colors.py 29 30 * GD users must upgrade to gd-2.0.22 and gdmodule-0.52 since new gd 31 features (clipping, antialiased lines) are now used. 32 33 * Renderer must implement points_to_pixels 34 35 Migrating code: 36 37 MATLAB interface: 38 39 The only API change for those using the MATLAB interface is in how 40 you call figure redraws for dynamically updating figures. In the 41 old API, you did 42 43 fig.draw() 44 45 In the new API, you do 46 47 manager = get_current_fig_manager() 48 manager.canvas.draw() 49 50 See the examples system_monitor.py, dynamic_demo.py, and anim.py 51 52 API 53 54 There is one important API change for application developers. 55 Figure instances used subclass GUI widgets that enabled them to be 56 placed directly into figures. e.g., FigureGTK subclassed 57 gtk.DrawingArea. Now the Figure class is independent of the 58 backend, and FigureCanvas takes over the functionality formerly 59 handled by Figure. In order to include figures into your apps, 60 you now need to do, for example 61 62 # gtk example 63 fig = Figure(figsize=(5,4), dpi=100) 64 canvas = FigureCanvasGTK(fig) # a gtk.DrawingArea 65 canvas.show() 66 vbox.pack_start(canvas) 67 68 If you use the NavigationToolbar, this in now initialized with a 69 FigureCanvas, not a Figure. The examples embedding_in_gtk.py, 70 embedding_in_gtk2.py, and mpl_with_glade.py all reflect the new 71 API so use these as a guide. 72 73 All prior calls to 74 75 figure.draw() and 76 figure.print_figure(args) 77 78 should now be 79 80 canvas.draw() and 81 canvas.print_figure(args) 82 83 Apologies for the inconvenience. This refactorization brings 84 significant more freedom in developing matplotlib and should bring 85 better plotting capabilities, so I hope the inconvenience is worth 86 it. 87