-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Don't do draw_marker optimization for large paths #3826
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
9e1b7ae
28c13f4
34c755c
73b7b7c
4e42686
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,12 +6,16 @@ | |
import io | ||
import os | ||
|
||
import numpy as np | ||
from numpy.testing import assert_array_almost_equal | ||
|
||
from matplotlib.image import imread | ||
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas | ||
from matplotlib.figure import Figure | ||
from matplotlib.testing.decorators import cleanup | ||
from matplotlib import pyplot as plt | ||
from matplotlib import collections | ||
from matplotlib import path | ||
|
||
|
||
@cleanup | ||
|
@@ -47,6 +51,21 @@ def test_repeated_save_with_alpha(): | |
decimal=3) | ||
|
||
|
||
@cleanup | ||
def test_large_single_path_collection(): | ||
buff = io.BytesIO() | ||
|
||
# Generates a too-large single path in a path collection that | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about doing this with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's a good idea. Will update. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated. |
||
# would cause a segfault if the draw_markers optimization is | ||
# applied. | ||
f, ax = plt.subplots() | ||
collection = collections.PathCollection( | ||
[path.Path([[-10, 5], [10, 5], [10, -5], [-10, -5], [-10, 5]])]) | ||
ax.add_artist(collection) | ||
ax.set_xlim(10**-3, 1) | ||
plt.savefig(buff) | ||
|
||
|
||
def report_memory(i): | ||
pid = os.getpid() | ||
a2 = os.popen('ps -p %d -o rss,sz' % pid).readlines() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How come there is a len here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trans
is a list of transforms (or, a 3-dim array of transforms), one for each actual instance of the path. It is optional, though, and may be zero length.