Skip to content

Commit 9382a05

Browse files
authored
Merge pull request #11637 from dstansby/api-split
Split API changes into individual pages
2 parents 2eb26ee + 16fee16 commit 9382a05

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+3788
-3799
lines changed

doc/api/api_changes.rst

Lines changed: 22 additions & 3799 deletions
Large diffs are not rendered by default.

doc/api/api_changes_old.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
================
3+
Old API Changes
4+
================
5+
6+
.. toctree::
7+
:glob:
8+
:reversed:
9+
:maxdepth: 1
10+
11+
prev_api_changes/*
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
2+
Changes for 0.40
3+
================
4+
5+
.. code-block:: text
6+
7+
- Artist
8+
* __init__ takes a DPI instance and a Bound2D instance which is
9+
the bounding box of the artist in display coords
10+
* get_window_extent returns a Bound2D instance
11+
* set_size is removed; replaced by bbox and dpi
12+
* the clip_gc method is removed. Artists now clip themselves with
13+
their box
14+
* added _clipOn boolean attribute. If True, gc clip to bbox.
15+
16+
- AxisTextBase
17+
* Initialized with a transx, transy which are Transform instances
18+
* set_drawing_area removed
19+
* get_left_right and get_top_bottom are replaced by get_window_extent
20+
21+
- Line2D Patches now take transx, transy
22+
* Initialized with a transx, transy which are Transform instances
23+
24+
- Patches
25+
* Initialized with a transx, transy which are Transform instances
26+
27+
- FigureBase attributes dpi is a DPI instance rather than scalar and
28+
new attribute bbox is a Bound2D in display coords, and I got rid
29+
of the left, width, height, etc... attributes. These are now
30+
accessible as, for example, bbox.x.min is left, bbox.x.interval()
31+
is width, bbox.y.max is top, etc...
32+
33+
- GcfBase attribute pagesize renamed to figsize
34+
35+
- Axes
36+
* removed figbg attribute
37+
* added fig instance to __init__
38+
* resizing is handled by figure call to resize.
39+
40+
- Subplot
41+
* added fig instance to __init__
42+
43+
- Renderer methods for patches now take gcEdge and gcFace instances.
44+
gcFace=None takes the place of filled=False
45+
46+
- True and False symbols provided by cbook in a python2.3 compatible
47+
way
48+
49+
- new module transforms supplies Bound1D, Bound2D and Transform
50+
instances and more
51+
52+
- Changes to the MATLAB helpers API
53+
54+
* _matlab_helpers.GcfBase is renamed by Gcf. Backends no longer
55+
need to derive from this class. Instead, they provide a factory
56+
function new_figure_manager(num, figsize, dpi). The destroy
57+
method of the GcfDerived from the backends is moved to the derived
58+
FigureManager.
59+
60+
* FigureManagerBase moved to backend_bases
61+
62+
* Gcf.get_all_figwins renamed to Gcf.get_all_fig_managers
63+
64+
Jeremy:
65+
66+
Make sure to self._reset = False in AxisTextWX._set_font. This was
67+
something missing in my backend code.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
Changes for 0.42
2+
================
3+
4+
.. code-block:: text
5+
6+
* Refactoring AxisText to be backend independent. Text drawing and
7+
get_window_extent functionality will be moved to the Renderer.
8+
9+
* backend_bases.AxisTextBase is now text.Text module
10+
11+
* All the erase and reset functionality removed from AxisText - not
12+
needed with double buffered drawing. Ditto with state change.
13+
Text instances have a get_prop_tup method that returns a hashable
14+
tuple of text properties which you can use to see if text props
15+
have changed, e.g., by caching a font or layout instance in a dict
16+
with the prop tup as a key -- see RendererGTK.get_pango_layout in
17+
backend_gtk for an example.
18+
19+
* Text._get_xy_display renamed Text.get_xy_display
20+
21+
* Artist set_renderer and wash_brushes methods removed
22+
23+
* Moved Legend class from matplotlib.axes into matplotlib.legend
24+
25+
* Moved Tick, XTick, YTick, Axis, XAxis, YAxis from matplotlib.axes
26+
to matplotlib.axis
27+
28+
* moved process_text_args to matplotlib.text
29+
30+
* After getting Text handled in a backend independent fashion, the
31+
import process is much cleaner since there are no longer cyclic
32+
dependencies
33+
34+
* matplotlib.matlab._get_current_fig_manager renamed to
35+
matplotlib.matlab.get_current_fig_manager to allow user access to
36+
the GUI window attribute, e.g., figManager.window for GTK and
37+
figManager.frame for wx
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
2+
Changes 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.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
Changes for 0.54.3
3+
==================
4+
5+
.. code-block:: text
6+
7+
removed the set_default_font / get_default_font scheme from the
8+
font_manager to unify customization of font defaults with the rest of
9+
the rc scheme. See examples/font_properties_demo.py and help(rc) in
10+
matplotlib.matlab.

0 commit comments

Comments
 (0)