Skip to content

Commit 38b394c

Browse files
committed
DOC: more editing
1 parent 771e682 commit 38b394c

File tree

1 file changed

+34
-28
lines changed

1 file changed

+34
-28
lines changed

docs/source/design.rst

Lines changed: 34 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,9 @@ version of these function chains where the objects allow us to modify the
4444
arguments to the functions and the re-run them.
4545

4646
The goal of this work is to bring this structure more to the foreground in the
47-
internal structure of Matplotlib. By exposing this inherent structure
48-
uniformity in the architecture of Matplotlib the library will be easier to
49-
reason about and easier to extend by injecting custom logic at each of
50-
the steps
47+
internal structure of Matplotlib. By exposing this inherent structure in the
48+
architecture of Matplotlib the library will be easier to reason about and
49+
easier to extend by injecting custom logic at each of the steps.
5150

5251
A paper with the formal mathematical description of these ideas is in
5352
preparation.
@@ -58,41 +57,48 @@ Data pipeline
5857
Get the data (Step 1)
5958
---------------------
6059

61-
In this context "data" is post any data-to-data transformations or
62-
aggregations. There is already extensive tooling and literature around that
63-
aspect. By completely decoupling the aggregations pipeline from the
64-
visualization process we are able to both simplify and generalize the problem.
60+
In this context "data" is post any data-to-data transformations or aggregation
61+
steps. There is already extensive tooling and literature around that aspect
62+
which we do not need to recreate. By completely decoupling the aggregations
63+
pipeline from the visualization process we are able to both simplify and
64+
generalize the software.
6565

6666
Currently, almost all ``Artist`` classes store the data they are representing
6767
as attributes on the instances as realized `numpy.array` [#]_ objects. On one
68-
hand, this can be very useful as historically data was frequently already in
68+
hand, this can be very convenient as data is frequently already in
6969
`numpy.array` objects in the users' namespace. If you know the right methods
7070
for *this* ``Artist``, you can query or update the data without recreating the
71-
Artist. This is technically consistent with the scheme laid out above if we
72-
understand ``self.x[:]`` as ``self.x.__getitem__(slice())`` which is a function
73-
call.
74-
75-
However, this method of storing the data has several drawbacks. In most cases
76-
the data attributes on an ``Artist`` are closely linked -- the *x* and *y* on a
77-
`~matplotlib.lines.Line2D` must be the same length -- and by storing them
78-
separately it is possible for them to become inconsistent in ways that noticed
79-
until draw time [#]_. Further, because the data is stored as materialized
71+
``Artist``. This is technically consistent with the scheme laid out above if
72+
we understand ``self.x[:]`` as ``self.x.__getitem__(slice())`` which is the
73+
function call in step 1.
74+
75+
However, this method of storing the data has several drawbacks.
76+
77+
In most cases the data attributes on an ``Artist`` are closely linked -- the
78+
*x* and *y* on a `~matplotlib.lines.Line2D` must be the same length -- and by
79+
storing them separately it is possible for them to become inconsistent in ways
80+
that noticed until draw time [#]_. With the rise of more structured data, such
81+
as ``pandas.DataFrame`` and ``xarray.Dataset`` users are more frequently having
82+
their data is coherent objects rather than individual arrays. Currently
83+
Matplotlib requires that these structures be decomposed and losing the
84+
association between the individual arrays.
85+
86+
An goal of this project is to bring support for draw-time resampling to every
87+
Matplotlib ``Artist``. Further, because the data is stored as materialized
8088
``numpy`` arrays, we must decide before draw time what the correct sampling of
81-
the data is. While there are some projects like `grave <https://networkx.ors
82-
g/grave/>`__ that wrap richer objects or `mpl-modest-image
89+
the data is. Projects like `grave <https://networkx.ors g/grave/>`__ that wrap
90+
richer objects or `mpl-modest-image
8391
<https://github.com/ChrisBeaumont/mpl-modest-image>`__, `datashader
8492
<https://datashader.org/getting_started/Interactivity.html#native-support-for-matplotlib>`__,
8593
and `mpl-scatter-density <https://github.com/astrofrog/mpl-scatter-density>`__
86-
that dynamically re-sample the data, these libraries have had only limited
94+
that dynamically re-sample the data do exist, but they have only seen limited
8795
adoption.
8896

89-
The first goal of this project is to bring support for draw-time resampling to
90-
every Matplotlib ``Artist``. The proposed approach is to move the data storage
91-
of the ``Artist`` to be indirectly via a (so-called)
92-
`~data_prototype.containers.DataContainer` instance rather than directly. The
93-
primary method on these objects is the
94-
`~data_prototype.containers.DataContainer.query` method which has the signature
95-
::
97+
This is a proposal to add a level of indirection the data storage -- via a
98+
(so-called) `~data_prototype.containers.DataContainer` -- rather than directly
99+
as individual numpy arrays on the ``Artist`` instances. The primary method on
100+
these objects is the `~data_prototype.containers.DataContainer.query` method
101+
which has the signature ::
96102

97103
def query(
98104
self,

0 commit comments

Comments
 (0)