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

Skip to content

Commit 8798272

Browse files
committed
minor revisions to design goals
svn path=/trunk/matplotlib/; revision=3570
1 parent 06da138 commit 8798272

1 file changed

Lines changed: 65 additions & 37 deletions

File tree

mpl1/DESIGN_GOALS

Lines changed: 65 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -19,45 +19,50 @@ move the data around on every draw
1919
Support a normal transformation architecture. The current draft
2020
implmentation assumes one nonlinear transformation, which happens at a
2121
high layer, and all transformations after that are affines. Currently
22-
there are two affines: the transformation from view limits -> axes
22+
there are three affines: the transformation from view limits -> axes
2323
units, the transformation from axes units to normalized figure untis,
2424
and the transformation from normalized figure units to display
2525

26-
do we want to use 3x3 or 4x4 to leave the door open for 3D developers?
26+
Do we want to use 3x3 or 4x4 to leave the door open for 3D developers?
2727

2828
= objects that talk to the backend "primitives" =
2929

30-
Have just a few, fairly rich obects the backends need to understand.
31-
clear candidates are a Path, Text and Image. Each of these will carry
32-
their metadata, eg a path will carry its stroke color, facecolor,
33-
linewidth, etc.. Text will carry its font size, color, etc. We may
34-
need some optimizations down the road, but start small. For now,
35-
let's call these objects primitives
30+
Have just a few, fairly rich obects, that the backends need to
31+
understand. Clear candidates are a Path, Text and Image, but despite
32+
some similar names, don't confuse these with the current matplotlib
33+
Artists by the same name, which are considerably higher level than
34+
what I'm thinking of here. Each of these will carry their metadata,
35+
eg a path will carry its stroke color, facecolor, linewidth, etc..
36+
Text will carry its font size, color, etc. We may need some
37+
optimizations down the road, but start small. For now, let's call
38+
these objects "primitives".
3639

3740
= where do the plot functions live? =
3841

39-
In matplotlib, the plot functions are axes methods and this is a poor
40-
design. Where should these live, what should they create, etc?
42+
In matplotlib, the plot functions are axes methods and I think there
43+
is consensus that this is a poor design. Where should these live,
44+
what should they create, etc?
4145

4246
= how much of an intermediate artist layer do we need =
4347

4448
Do we want to create high level objects like Circle, Rectangle and
45-
Line, each of which manage a Path object under the hood? Probably.
46-
By using traits properly here, these will be thin interfaces around
47-
one of our primitives.
49+
Line, each of which manage a Path object under the hood? Probably,
50+
for user convenience and general compability with matplotlib. By
51+
using traits properly here, these will be thin interfaces around one
52+
of our primitives.
4853

4954
= z-ordering, containers, etc =
5055

5156
Peter has been doing a lot of nice work on z-order and layers and
5257
stuff like that for chaco, stuff that looks really useful for picking,
5358
interactive, etc... We should look at their approach, and think
54-
carefully about how this should be handled. Paul is a good candidate
55-
for this.
59+
carefully about how this should be handled. Paul may be a good
60+
candidate for this, since he has been working on picking.
5661

5762
= extension code =
5863

5964
I would like to shed all of the CXX extension code -- it is just too
60-
small a nitch of the python world to base our proect on. SWIG is
65+
small a nitch of the python world to base our project on. SWIG is
6166
pretty clearly the right choice. mpl1 will use numpy for
6267
transformations with some carefully chosen extension code where
6368
necessary, so this gets rid of _transforms.cpp. I also plan to use
@@ -67,50 +72,73 @@ Having a fully featured python agg wrapper will be a plus. But with
6772
the agg license change, I'm open to discussion of alternatives.
6873

6974
I want to do away with *all* GUI extension code. This should live
70-
outside MPL, eg in a toolkit, if we need it. This means someone
71-
(Michael is probably a good choice) needs to figure out how to get tk
72-
talking to a python buffer or numpy array. Maintaining the GUI
73-
extension code is a drag.
75+
outside MPL, eg in a toolkit, if we need it. This means someone needs
76+
to figure out how to get tk talking to a python buffer or numpy array.
77+
Maintaining the GUI extension code across platforms is an unending
78+
headache.
7479

7580
= traits =
7681

7782
I think we should make a major committment to traits and use them from
78-
the ground up. w/o the UI stuff, they add plenty to make them
79-
worthwhile. With the UI (wx only) , they are a major win for GUI
80-
developers.
83+
the ground up. Without the UI stuff, they add plenty to make them
84+
worthwhile, especially the validation and notification features. With
85+
the UI (wx only) , they are a major win for GUI developers. Compare
86+
the logic for sharing an x-axis in matplotlib transforms with sharex
87+
with the approach used in mpl1.py with synch-ed affines.
8188

8289
= axis handling =
8390

84-
The whole conception of the Axes needs to be reworked, in light of the
85-
fact that we need to support multiple axis objects on one Axes. This
86-
will require a fair amount of thought, but we should aim for
91+
The whole conception of the Axes needs to be rethought, in light of
92+
the fact that we need to support multiple axis objects on one Axes.
93+
The matplotlib implementation assumes 1 xaxis and 1 yaxis per Axes,
94+
and we hack two y-axis support with some transform shenanigans via
95+
twinx, but the approach is not generalizable and is unweildy.
96+
97+
This will require a fair amount of thought, but we should aim for
8798
supporting an arbitrary number of axis obects, presumably associated
8899
with individual artists or primitives, on each Axes. They also need
89100
to be *much* faster. matplotlib uses Artists for each tick, tickline,
90-
gridline, ticklabel, etc, and this is mind-numbingsly slow.
101+
gridline, ticklabel, etc, and this is mind-numbingsly slow.
91102

92103
= breakage =
93104

94-
I think we need to be prepared to break the hell out of this thing.
105+
I think we need to be prepared to break the hell out of matplotlib.
95106
The API will basically be a total rewrite. pylab will still mostly
96-
work unchanged -- that is the beauty of pylab. We'll probably want to
107+
work unchanged -- that is the beauty of pylab - though API calls on
108+
return obects will probably be badly broken. We'll probably want to
97109
install into a new namespace, eg mpl, and envision both matplotlib and
98110
mpl co-existing for some time. In fact, mpl might depend on
99111
matplotlib for a while (eg until a CXX free ft2font is available)
100112

101113
We should expect to be supporting and using matplotlib for a long
102114
time, since the proposals discussed here imply that it will be a long
103115
wait until mpl1 is feature complete with matplotlib. In fact, we could
104-
rightly consider this to be the mpl2 proposal, and keep releaseing
116+
rightly consider this to be the mpl2 proposal, and keep releasing
105117
matplotlib ehancements to 1.0 and beyond w/o signfificant breakage.
106118
It's a nominal difference so I don't really have a preference.
107119

108-
= chaco and kiva =
120+
Or we could forget all this wild speculation and resume our normally
121+
scheduled lives.
109122

110-
This is probably a good idea for an enterprising developer to take a
111-
careful look at Chaco and Kiva to see if we can integrate with them.
112-
I am gunshy because they seem formiddable and complex, and one of my
113-
maor goals here is to streamline and simplify, but they are incredible
114-
pieces of work and we need to consider them, especially if we
115-
integrate other parts of the enthought suite into our core, eg traits
123+
= chaco and kiva =
116124

125+
It is a good idea for an enterprising developer to take a careful look
126+
at tghe current Chaco and Kiva to see if we can further integrate with
127+
them. I am gun shy because they seem formiddable and complex, and one
128+
of my major goals here is to streamline and simplify, but they are
129+
incredible pieces of work and we need to carefully consider them,
130+
especially as we integrate other parts of the enthought suite into our
131+
core, eg traits, increasing the possibility of synergies.
132+
133+
134+
= unit handling, custom object types =
135+
136+
There is a legitimate need to be able to feed custom objects into
137+
matplotlib. Recent versions of matplotlib support this with a unit
138+
registry. A clear use case is plotting with native datetime objects,
139+
which is supported in the latest release of matplotlib via the unit
140+
handling, which should probably be called "custom object handling and
141+
conversion". This is a deep and complicaed subect, involving
142+
questions of where the original data live, how they are converted to
143+
useful types (arrays of floats) etc. It's worth thinking about as we
144+
discuss redesign issues.

0 commit comments

Comments
 (0)