Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2594eb6

Browse filesBrowse files
authored
Merge pull request #10332 from anntzer/join-strings
Join strings instead of adding them.
2 parents 4ad2f32 + 1aaf38b commit 2594eb6
Copy full SHA for 2594eb6

File tree

Expand file treeCollapse file tree

4 files changed

+12
-18
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+12
-18
lines changed

‎lib/matplotlib/animation.py

Copy file name to clipboardExpand all lines: lib/matplotlib/animation.py
+3-5Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -842,11 +842,9 @@ def _included_frames(frame_list, frame_format):
842842
def _embedded_frames(frame_list, frame_format):
843843
"""frame_list should be a list of base64-encoded png files"""
844844
template = ' frames[{0}] = "data:image/{1};base64,{2}"\n'
845-
embedded = "\n"
846-
for i, frame_data in enumerate(frame_list):
847-
embedded += template.format(i, frame_format,
848-
frame_data.replace('\n', '\\\n'))
849-
return embedded
845+
return "\n" + "".join(
846+
template.format(i, frame_format, frame_data.replace('\n', '\\\n'))
847+
for i, frame_data in enumerate(frame_list))
850848

851849

852850
@writers.register('html')

‎lib/matplotlib/backends/backend_pgf.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_pgf.py
+4-5Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -582,11 +582,10 @@ def _print_pgf_path_styles(self, gc, rgbFace):
582582
if dash_list is None:
583583
writeln(self.fh, r"\pgfsetdash{}{0pt}")
584584
else:
585-
dash_str = r"\pgfsetdash{"
586-
for dash in dash_list:
587-
dash_str += r"{%fpt}" % dash
588-
dash_str += r"}{%fpt}" % dash_offset
589-
writeln(self.fh, dash_str)
585+
writeln(self.fh,
586+
r"\pgfsetdash{%s}{%fpt}"
587+
% ("".join(r"{%fpt}" % dash for dash in dash_list),
588+
dash_offset))
590589

591590
def _print_pgf_path(self, gc, path, transform, rgbFace=None):
592591
f = 1. / self.dpi

‎lib/matplotlib/backends/backend_wx.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_wx.py
+3-6Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1446,12 +1446,9 @@ def getActiveAxes(self):
14461446
return active
14471447

14481448
def updateButtonText(self, lst):
1449-
"""Update the list of selected axes in the menu button"""
1450-
axis_txt = ''
1451-
for e in lst:
1452-
axis_txt += '%d,' % (e + 1)
1453-
# remove trailing ',' and add to button string
1454-
self.SetLabel("Axes: %s" % axis_txt[:-1])
1449+
"""Update the list of selected axes in the menu button."""
1450+
self.SetLabel(
1451+
'Axes: ' + ','.join('%d' % (e + 1) for e in lst))
14551452

14561453

14571454
cursord = {

‎lib/matplotlib/legend.py

Copy file name to clipboardExpand all lines: lib/matplotlib/legend.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,12 +1311,12 @@ def _get_legend_handles(axs, legend_handler_map=None):
13111311
handles_original = []
13121312
for ax in axs:
13131313
handles_original += (ax.lines + ax.patches +
1314-
ax.collections + ax.containers)
1314+
ax.collections + ax.containers)
13151315
# support parasite axes:
13161316
if hasattr(ax, 'parasites'):
13171317
for axx in ax.parasites:
13181318
handles_original += (axx.lines + axx.patches +
1319-
axx.collections + axx.containers)
1319+
axx.collections + axx.containers)
13201320

13211321
handler_map = Legend.get_default_handler_map()
13221322

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.