Commit 5570642
committed
FIX: do not simplify path in LineCollection.get_segments
Internally all Collection flavors boil down to calling
renderer.draw_path_collection and the sub-classes primarily provide nicer
user-facing APIs to fabricate the paths that will be passed down to the
renderer.
In LineCollection rather than tracking both the user supplied data and the
internal Path objects, we just keep the Path objects and re-extract segments on
demand.
To do this we use Path.iter_segments with defaults to asking the path if it
should simplify the path (that is drop points that do not matter which is in
turn defined by if the deflection away from "straight" is greater than some
threshold). The Path objects we are holding have values in data-space, but the
default value of "what is the threshold for 'not mattering'" is tuned to make
sense in to pixel space (1/9). By passing `simplify=False` to `iter_segments`
we over-ride the Path object's notion of if it should be simplified (which by
default is controlled by the simplify
threshold (rcParams['path.simplify_threshold']), rcParams['path.simplify'] ,
how long the path is, and if there are any quadratic or Bézier codes in the
path) to never simplify.
In this application we never want to simplify because we do not know enough of
the context when this is called to know what the "right" simplification
threshold is and because we expect `set_segments` and `get_segments` to
round-trip.
closes matplotlib#205511 parent 06141da commit 5570642
2 files changed
+17
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1461 | 1461 | | |
1462 | 1462 | | |
1463 | 1463 | | |
1464 | | - | |
| 1464 | + | |
| 1465 | + | |
| 1466 | + | |
| 1467 | + | |
| 1468 | + | |
| 1469 | + | |
| 1470 | + | |
| 1471 | + | |
1465 | 1472 | | |
1466 | 1473 | | |
1467 | 1474 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1039 | 1039 | | |
1040 | 1040 | | |
1041 | 1041 | | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
0 commit comments