X Tutup
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions lib/matplotlib/backend_bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,10 @@ def draw_path_collection(self, gc, master_transform, paths, all_transforms,
path_ids.append((path, transforms.Affine2D(transform)))

for xo, yo, path_id, gc0, rgbFace in self._iter_collection(
gc, master_transform, all_transforms, path_ids, offsets,
offsetTrans, facecolors, edgecolors, linewidths, linestyles,
antialiaseds, urls, offset_position):
gc, master_transform, all_transforms, paths, path_ids,
offsets, offsetTrans, facecolors, edgecolors,
linewidths, linestyles, antialiaseds, urls,
offset_position):
path, transform = path_id
transform = transforms.Affine2D(
transform.get_matrix()).translate(xo, yo)
Expand Down Expand Up @@ -400,11 +401,11 @@ def _iter_collection_uses_per_path(self, paths, all_transforms,
if Npaths == 0 or (len(facecolors) == 0 and len(edgecolors) == 0):
return 0
Npath_ids = max(Npaths, len(all_transforms))
N = max(Npath_ids, len(offsets))
N = max(Npaths, len(offsets))
return (N + Npath_ids - 1) // Npath_ids

def _iter_collection(self, gc, master_transform, all_transforms,
path_ids, offsets, offsetTrans, facecolors,
paths, path_ids, offsets, offsetTrans, facecolors,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@WeatherGod Right, I noticed the new arg at the end, but not the one in the middle.

edgecolors, linewidths, linestyles,
antialiaseds, urls, offset_position):
"""
Expand Down Expand Up @@ -433,7 +434,8 @@ def _iter_collection(self, gc, master_transform, all_transforms,
use for filling the path.
"""
Ntransforms = len(all_transforms)
Npaths = len(path_ids)
Npaths = len(paths)
Npath_ids = len(path_ids)
Noffsets = len(offsets)
N = max(Npaths, Noffsets)
Nfacecolors = len(facecolors)
Expand All @@ -459,7 +461,7 @@ def _iter_collection(self, gc, master_transform, all_transforms,

xo, yo = 0, 0
for i in xrange(N):
path_id = path_ids[i % Npaths]
path_id = path_ids[i % Npath_ids]
if Noffsets:
xo, yo = toffsets[i % Noffsets]
if offset_position == 'data':
Expand Down
7 changes: 4 additions & 3 deletions lib/matplotlib/backends/backend_pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -1705,9 +1705,10 @@ def draw_path_collection(self, gc, master_transform, paths, all_transforms,
output(*self.gc.push())
lastx, lasty = 0, 0
for xo, yo, path_id, gc0, rgbFace in self._iter_collection(
gc, master_transform, all_transforms, path_codes, offsets,
offsetTrans, facecolors, edgecolors, linewidths, linestyles,
antialiaseds, urls, offset_position):
gc, master_transform, all_transforms, paths, path_codes,
offsets, offsetTrans, facecolors, edgecolors,
linewidths, linestyles, antialiaseds, urls,
offset_position):

self.check_gc(gc0, rgbFace)
dx, dy = xo - lastx, yo - lasty
Expand Down
8 changes: 4 additions & 4 deletions lib/matplotlib/backends/backend_ps.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ def draw_path_collection(self, gc, master_transform, paths, all_transforms,

path_codes = []
for i, (path, transform) in enumerate(self._iter_collection_raw_paths(
master_transform, paths, all_transforms)):
master_transform, paths, all_transforms)):
name = 'p%x_%x' % (self._path_collection_id, i)
ps_cmd = ['/%s {' % name,
'newpath', 'translate']
Expand All @@ -610,9 +610,9 @@ def draw_path_collection(self, gc, master_transform, paths, all_transforms,
path_codes.append(name)

for xo, yo, path_id, gc0, rgbFace in self._iter_collection(
gc, master_transform, all_transforms, path_codes, offsets,
offsetTrans, facecolors, edgecolors, linewidths, linestyles,
antialiaseds, urls, offset_position):
gc, master_transform, all_transforms, paths, path_codes,
offsets, offsetTrans, facecolors, edgecolors, linewidths,
linestyles, antialiaseds, urls, offset_position):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:-) Looks like you agree with me on this sort of indentation?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah -- just a "fixing while I'm in there adding arguments anyway" kind of thing.

ps = "%g %g %s" % (xo, yo, path_id)
self._draw_ps(ps, gc0, rgbFace)

Expand Down
8 changes: 4 additions & 4 deletions lib/matplotlib/backends/backend_svg.py
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ def draw_path_collection(self, gc, master_transform, paths, all_transforms,
path_codes = []
writer.start('defs')
for i, (path, transform) in enumerate(self._iter_collection_raw_paths(
master_transform, paths, all_transforms)):
master_transform, paths, all_transforms)):
transform = Affine2D(transform.get_matrix()).scale(1.0, -1.0)
d = self._convert_path(path, transform, simplify=False)
oid = 'C%x_%x_%s' % (self._path_collection_id, i,
Expand All @@ -661,9 +661,9 @@ def draw_path_collection(self, gc, master_transform, paths, all_transforms,
writer.end('defs')

for xo, yo, path_id, gc0, rgbFace in self._iter_collection(
gc, master_transform, all_transforms, path_codes, offsets,
offsetTrans, facecolors, edgecolors, linewidths, linestyles,
antialiaseds, urls, offset_position):
gc, master_transform, all_transforms, paths, path_codes,
offsets, offsetTrans, facecolors, edgecolors, linewidths,
linestyles, antialiaseds, urls, offset_position):
clipid = self._get_clip(gc0)
url = gc0.get_url()
if url is not None:
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/legend_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ def get_sizes(self, legend, orig_handle,
numpoints = self.get_numpoints(legend)
if numpoints < 4:
sizes = [.5 * (size_max + size_min), size_max,
size_min]
size_min][:numpoints]
else:
rng = (size_max - size_min)
sizes = rng * np.linspace(0, 1, numpoints) + size_min
Expand Down
Binary file modified lib/matplotlib/tests/baseline_images/test_legend/scatter_rc1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
X Tutup