Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3485 from jkseppan/reduce-xobjects
ENH : Reduce the use of XObjects in pdf backend
- Loading branch information
Showing
8 changed files
with
115 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
from matplotlib.backend_bases import RendererBase | ||
import matplotlib.transforms as transforms | ||
import matplotlib.path as path | ||
import numpy as np | ||
|
||
|
||
def test_uses_per_path(): | ||
id = transforms.Affine2D() | ||
paths = [path.Path.unit_regular_polygon(i) for i in range(3, 7)] | ||
tforms = [id.rotate(i) for i in range(1, 5)] | ||
offsets = np.arange(20).reshape((10, 2)) | ||
facecolors = ['red', 'green'] | ||
edgecolors = ['red', 'green'] | ||
|
||
def check(master_transform, paths, all_transforms, | ||
offsets, facecolors, edgecolors): | ||
rb = RendererBase() | ||
raw_paths = list(rb._iter_collection_raw_paths(master_transform, | ||
paths, all_transforms)) | ||
gc = rb.new_gc() | ||
ids = [path_id for xo, yo, path_id, gc0, rgbFace in | ||
rb._iter_collection(gc, master_transform, all_transforms, | ||
range(len(raw_paths)), offsets, | ||
transforms.IdentityTransform(), | ||
facecolors, edgecolors, [], [], [False], | ||
[], 'data')] | ||
uses = rb._iter_collection_uses_per_path( | ||
paths, all_transforms, offsets, facecolors, edgecolors) | ||
seen = [0] * len(raw_paths) | ||
for i in ids: | ||
seen[i] += 1 | ||
for n in seen: | ||
assert n in (uses-1, uses) | ||
|
||
check(id, paths, tforms, offsets, facecolors, edgecolors) | ||
check(id, paths[0:1], tforms, offsets, facecolors, edgecolors) | ||
check(id, [], tforms, offsets, facecolors, edgecolors) | ||
check(id, paths, tforms[0:1], offsets, facecolors, edgecolors) | ||
check(id, paths, [], offsets, facecolors, edgecolors) | ||
for n in range(0, offsets.shape[0]): | ||
check(id, paths, tforms, offsets[0:n, :], facecolors, edgecolors) | ||
check(id, paths, tforms, offsets, [], edgecolors) | ||
check(id, paths, tforms, offsets, facecolors, []) | ||
check(id, paths, tforms, offsets, [], []) | ||
check(id, paths, tforms, offsets, facecolors[0:1], edgecolors) |
Binary file modified
BIN
-432 KB
(12%)
lib/mpl_toolkits/tests/baseline_images/test_mplot3d/mixedsubplot.pdf
Binary file not shown.
Binary file modified
BIN
-483 KB
(13%)
lib/mpl_toolkits/tests/baseline_images/test_mplot3d/surface3d.pdf
Binary file not shown.