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

Skip to content

Commit 06da138

Browse files
committed
added design goals doc
svn path=/trunk/matplotlib/; revision=3569
1 parent 603d3e7 commit 06da138

3 files changed

Lines changed: 125 additions & 3 deletions

File tree

mpl1/DESIGN_GOALS

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
Here are some of the things I would like to accomplish with mpl1. Any
2+
and all of this is open to discussion. What I present below is pretty
3+
ambitious, so if there is support, we will need significant
4+
contributions from several developers for several months. Ideally, we
5+
would get a good sketch working, and then organize a spint (4 days?)
6+
for late August, where we try get as far as possible to making this
7+
viable.
8+
9+
= data copying =
10+
11+
Push the data to the backend only once, or only when required. update
12+
the transforms to the backend, but do not push transformed data on
13+
every draw. This is potentially a major win, because we currently
14+
move the data around on every draw
15+
16+
17+
= transformations =
18+
19+
Support a normal transformation architecture. The current draft
20+
implmentation assumes one nonlinear transformation, which happens at a
21+
high layer, and all transformations after that are affines. Currently
22+
there are two affines: the transformation from view limits -> axes
23+
units, the transformation from axes units to normalized figure untis,
24+
and the transformation from normalized figure units to display
25+
26+
do we want to use 3x3 or 4x4 to leave the door open for 3D developers?
27+
28+
= objects that talk to the backend "primitives" =
29+
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
36+
37+
= where do the plot functions live? =
38+
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?
41+
42+
= how much of an intermediate artist layer do we need =
43+
44+
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.
48+
49+
= z-ordering, containers, etc =
50+
51+
Peter has been doing a lot of nice work on z-order and layers and
52+
stuff like that for chaco, stuff that looks really useful for picking,
53+
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.
56+
57+
= extension code =
58+
59+
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
61+
pretty clearly the right choice. mpl1 will use numpy for
62+
transformations with some carefully chosen extension code where
63+
necessary, so this gets rid of _transforms.cpp. I also plan to use
64+
the SWIG agg wrapper, so this gets rid of _backend_agg. If we can
65+
enhance the SWIG agg wrapper, we can also do images through here.
66+
Having a fully featured python agg wrapper will be a plus. But with
67+
the agg license change, I'm open to discussion of alternatives.
68+
69+
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.
74+
75+
= traits =
76+
77+
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.
81+
82+
= axis handling =
83+
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
87+
supporting an arbitrary number of axis obects, presumably associated
88+
with individual artists or primitives, on each Axes. They also need
89+
to be *much* faster. matplotlib uses Artists for each tick, tickline,
90+
gridline, ticklabel, etc, and this is mind-numbingsly slow.
91+
92+
= breakage =
93+
94+
I think we need to be prepared to break the hell out of this thing.
95+
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
97+
install into a new namespace, eg mpl, and envision both matplotlib and
98+
mpl co-existing for some time. In fact, mpl might depend on
99+
matplotlib for a while (eg until a CXX free ft2font is available)
100+
101+
We should expect to be supporting and using matplotlib for a long
102+
time, since the proposals discussed here imply that it will be a long
103+
wait until mpl1 is feature complete with matplotlib. In fact, we could
104+
rightly consider this to be the mpl2 proposal, and keep releaseing
105+
matplotlib ehancements to 1.0 and beyond w/o signfificant breakage.
106+
It's a nominal difference so I don't really have a preference.
107+
108+
= chaco and kiva =
109+
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
116+

mpl1/mpl1.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# see install instructions for enthrought traits2 in mtraits
12
import enthought.traits.api as traits
23

34
from matplotlib import agg
@@ -395,7 +396,7 @@ def affine_rotation(theta):
395396
y2 = 10*npy.exp(-x)
396397

397398
line1 = line(x, y1, color='blue', linewidth=2.0)
398-
line1.affine = coords1.affine
399+
line1.sync_trait('affine', coords1)
399400

400401
fig.add_path(line1)
401402

mpl1/mtraits.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
"""
22
Install instructions for traits 2.0
33
4+
# blow away old enthought
45
rm -rf ~/dev/lib/python2.4/site-packages/enthought.*
56
6-
easy_install --install-dir=~/dev/lib/python2.4/site-packages --prefix=~/dev -f http://code.enthought.com/enstaller/eggs/source/unstable/ enthought.etsconfig enthought.util enthought.debug
7+
# get easy_install, if necessary
8+
wget http://peak.telecommunity.com/dist/ez_setup.py
9+
sudo python sez_setup.py
10+
11+
sudo easy_install -f http://code.enthought.com/enstaller/eggs/source/unstable/ enthought.etsconfig enthought.util enthought.debug
712
813
svn co https://svn.enthought.com/svn/enthought/branches/enthought.traits_2.0 enthought_traits
914
1015
cd enthought_traits/
11-
python setup.py install --prefix=~/dev
16+
sudo python setup.py install
1217
1318
1419
"""

0 commit comments

Comments
 (0)