|
4 | 4 | Unstructured data |
5 | 5 | ================= |
6 | 6 |
|
7 | | -Unlike :ref:`structured grids <plot_gridded>`, three-dimensional data is often |
8 | | -collected without the benefit of a grid, with :math:`z = f(x, y)` where |
9 | | -:math:`x` and :math:`y` are one-dimensional arrays of the same length, and |
10 | | -hence :math:`z` is also one-dimensional. Sometimes it is useful to grid that |
11 | | -data via appropriate interpolation schemes (see `scipy.interpolate.griddata` |
12 | | -for some in python). However, if the data is spaced appropriately, it can sometimes |
13 | | -be plotted directly in Matplotlib. |
14 | | -
|
15 | | -Matplotlib accomplishes this via a suite of triangulation routines in the |
16 | | -:mod:`matplotlib.tri` module. The most basic triangulation routine is |
17 | | -`~matplotlib.tri.Triangulation`, which is a simple wrapper around the popular |
18 | | -`Qhull <http://www.qhull.org/>`_ library. The `~matplotlib.tri.Triangulation` |
19 | | -class is used to create a triangulation of a set of points, and this |
20 | | -triangulation can then be used to create either faceted psuedocolor plots, or |
21 | | -contour plots. |
| 7 | +Unlike :ref:`structured grids <plot_gridded>`, unstructured data are not |
| 8 | +sampled on a regular grid. In this case, :math:`x` and :math:`y` are |
| 9 | +one-dimensional arrays of the same length, and :math:`z = f(x, y)` is also |
| 10 | +one-dimensional. For example, consider a temperature field |
| 11 | +:math:`T(\\text{longitude}, \\text{latitude})` measured at 120 weather stations, |
| 12 | +with each station at a different latitude and longitude. |
| 13 | +
|
| 14 | +You can interpolate this kind of data onto a regular grid (for example with |
| 15 | +`scipy.interpolate.griddata`), but if the sampling is suitable it can often be |
| 16 | +plotted directly in Matplotlib. |
| 17 | +
|
| 18 | +Matplotlib supports this through triangulation routines in |
| 19 | +:mod:`matplotlib.tri`. The `Qhull <http://www.qhull.org/>`_ library is used to |
| 20 | +build a triangulation from the input points via |
| 21 | +`~matplotlib.tri.Triangulation`, which can then be used for faceted |
| 22 | +pseudocolor and contour plots. |
| 23 | +
|
| 24 | +The triangulation treats the points :math:`(x, y)` as unordered, connecting |
| 25 | +points based on proximity. |
22 | 26 |
|
23 | 27 | """ |
24 | 28 |
|
@@ -87,7 +91,7 @@ class is used to create a triangulation of a set of points, and this |
87 | 91 | # -------------------------- |
88 | 92 | # |
89 | 93 | # The `~.axes.Axes.tricontour` and `~.axes.Axes.tricontourf` methods can be |
90 | | -# used to plot contours of unstractured data, where the underlying |
| 94 | +# used to plot contours of unstructured data, where the underlying |
91 | 95 | # triangulation is used to interpolate the contour locations. Here we plot |
92 | 96 | # contours of the same data as above. |
93 | 97 |
|
|
0 commit comments