Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 878b636

Browse files
committed
minor revisions to design goals
svn path=/trunk/matplotlib/; revision=3573
1 parent dc9504e commit 878b636

1 file changed

Lines changed: 50 additions & 37 deletions

File tree

mpl1/DESIGN_GOALS

Lines changed: 50 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -28,52 +28,58 @@ transformation from normalized figure units to display
2828

2929
Do we want to use 3x3 or 4x4 to leave the door open for 3D developers?
3030

31-
How do transformations (linear and nonlinear) play wtih Axis features
32-
(ticking and gridding). The ideal is an framework in which ticking,
33-
gridding and labeling work intelligently with arbitrary
34-
transformations. What is the proper transformation API?
31+
How do transformations (linear and nonlinear) play with Axis features
32+
(ticking and gridding). The ideal is a framework in which ticking,
33+
gridding and labeling work intelligently with arbitrary, user
34+
supplied, transformations. What is the proper transformation API?
3535

3636
= Objects that talk to the backend "primitives" =
3737

3838
Have just a few, fairly rich obects, that the backends need to
3939
understand. Clear candidates are a Path, Text and Image, but despite
40-
their similar names, don't confuse these with the current matplotlib
41-
eponymous matplotlib Artists, which are considerably higher level than
42-
what I'm thinking of here. Each of these will carry their metadata,
43-
eg a path will carry its stroke color, facecolor, linewidth, etc...,
44-
and Text will carry its font size, color, etc.... We may need some
45-
optimizations down the road, but we should start small. For now,
46-
let's call these objects "primitives".
40+
their names, don't confuse these with the eponymous matplotlib
41+
matplotlib Artists, which are higher level than what I'm thinking of
42+
here (eg matplotlib.text.Text does *a lot* of layout, and this would
43+
be offloaded ot the backend in this conception of the Text primitive).
44+
Each of these will carry their metadata, eg a path will carry its
45+
stroke color, facecolor, linewidth, etc..., and Text will carry its
46+
font size, color, etc.... We may need some optimizations down the
47+
road, but we should start small. For now, let's call these objects
48+
"primitives".
49+
50+
This approach requires the backends to be smarter, but they have to
51+
handle fewer entities.
4752

4853
= Where do the plot functions live? =
4954

50-
In matplotlib, the plot functions are axes methods and I think there
51-
is consensus that this is a poor design. Where should these live,
52-
what should they create, etc?
55+
In matplotlib, the plot functions are matplotlib.axes.Axes methods and
56+
I think there is consensus that this is a poor design. Where should
57+
these live, what should they create, etc?
5358

5459
= How much of an intermediate artist layer do we need? =
5560

5661
Do we want to create high level objects like Circle, Rectangle and
5762
Line, each of which manage a Path object under the hood? Probably,
5863
for user convenience and general compability with matplotlib. By
5964
using traits properly here, many current matplotlib Arists will be
60-
thin interfaces around one oer more primitives.
65+
thin interfaces around one or more primitives.
6166

6267
I think the whole matplotlib.collections module is poorly designed,
6368
and should be chucked wholesale, in favor of faster, more elegant,
6469
optimizations and special cases. Just having the right Path object
6570
will reduce the need for many of these, eg LineCollection,
6671
PolygonCollection, etc... Also, everything should be numpy enabled,
6772
and the sequence-of-python-tuples approach that many of the
68-
collections take should be dropped.
73+
collections take should be dropped. Obviously some of the more useful
74+
things there, like quad meshes, need to be ported and retained.
6975

7076
= Z-ordering, containers, etc =
7177

7278
Peter has been doing a lot of nice work on z-order and layers for
7379
chaco, stuff that looks really useful for picking, interaction, etc...
7480
We should look at this approach, and think carefully about how this
7581
should be handled. Paul may be a good candidate for this, since he
76-
has been working recently on picking.
82+
has been working recently on the picking API.
7783

7884
= Extension code =
7985

@@ -88,6 +94,10 @@ _image.cpp. Having a fully featured, python-exposed agg wrapper will
8894
be a plus in mpl and beyond. But with the agg license change, I'm
8995
open to discussion of other approaches.
9096

97+
The major missing piece in ft2font, which is a pretty elaborate CXX
98+
module. Michael may want to consider alternatives, including looking
99+
at the agg support for freetype, and the kiva/chaco approach.
100+
91101
I want to do away with *all* GUI extension code. This should live
92102
outside MPL if at all, eg in a toolkit if we need it. This means
93103
someone needs to figure out how to get TkInter talking to a python
@@ -106,12 +116,12 @@ affines.
106116

107117
= Axis handling =
108118

109-
The whole concept of the Axes needs to be rethought, in light of the
110-
fact that we need to support multiple axis objects on one Axes. The
111-
matplotlib implementation assumes 1 xaxis and 1 yaxis per Axes, and we
112-
hack two y-axis support (examples/two_scales.py) with some transform
113-
shenanigans via twinx, but the approach is not generalizable and is
114-
unwieldy.
119+
The whole concept of the Axes object needs to be rethought, in light
120+
of the fact that we need to support multiple axis objects on one Axes.
121+
The matplotlib implementation assumes 1 xaxis and 1 yaxis per Axes,
122+
and we hack two y-axis support (examples/two_scales.py) with some
123+
transform shenanigans via twinx and multiple Axes where one is hidden,
124+
but the approach is not scalable and is unwieldy.
115125

116126
This will require a fair amount of thought, but we should aim for
117127
supporting an arbitrary number of axis obects, presumably associated
@@ -122,19 +132,22 @@ axis implementations that draws the ticks with a single path using
122132
repeated MOVETO and LINETO, for example, which will be incomparably
123133
faster than using a separate object for each tick.
124134

125-
= Breakage =
135+
The other important featiure for axis support is that, for the most
136+
part, they should be arbitrarily placeable (eg a "detached" axis).
137+
138+
= Breakage =
126139

127140
I think we need to be prepared to break the hell out of matplotlib.
128-
The API will basically be a total rewrite. pylab will still mostly
129-
work unchanged -- that is the beauty of pylab -- though API calls on
130-
return obects may be badly broken. We can mitigate this pain if we
131-
desire with clever wrapper objects, but once you start calling methods
132-
on return objects, you join the community of power users, and this is
133-
the community I'm most willing to inconvenience with breakage. We'll
134-
probably want to install into a new namespace, eg "mpl", and envision
135-
both matplotlib and mpl co-existing for some time. In fact, mpl might
136-
depend on matplotlib initially, eg until a CXX free ft2font is
137-
available.
141+
The API will basically be a significant rewrite. pylab will still
142+
mostly work unchanged -- that is the beauty of pylab -- though API
143+
calls on return objects may be badly broken. We can mitigate this pain
144+
if we desire with clever wrapper objects, but once you start calling
145+
methods on return objects, you join the community of power users, and
146+
this is the community I'm most willing to inconvenience with breakage.
147+
We'll probably want to install into a new namespace, eg "mpl", and
148+
envision both matplotlib and mpl co-existing for some time. In fact,
149+
mpl might depend on matplotlib initially, eg until a CXX-free ft2font
150+
is available.
138151

139152
We should expect to be supporting and using matplotlib for a long
140153
time, since the proposals discussed here imply that it will be a long
@@ -162,9 +175,9 @@ core, eg traits, increasing the possibility of synergies.
162175
There is a legitimate need to be able to feed custom objects into
163176
matplotlib. Recent versions of matplotlib support this with a unit
164177
registry in the "units" module. A clear use case is plotting with
165-
native datetime objects, which is supported in 0.90 via the unit
166-
handling, which should probably be called "custom object handling and
167-
conversion". This is a deep and complicated subject, involving
178+
native python datetime objects, which is supported in 0.90 via the
179+
unit handling, which should probably be called "custom object handling
180+
and conversion". This is a deep and complicated subject, involving
168181
questions of where the original data live, how they are converted to
169182
useful types (arrays of floats) etc. It's worth thinking this about
170183
as we discuss redesign issues.

0 commit comments

Comments
 (0)