speedup figure rendering removal of .startswith() calls and use generato... by mmokrejs · Pull Request #2289 · matplotlib/matplotlib · GitHub
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
8 changes: 4 additions & 4 deletions lib/matplotlib/artist.py
6 changes: 3 additions & 3 deletions lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def get_legend_handles_labels(self, legend_handler_map=None):
labels = []
for handle in self._get_legend_handles(legend_handler_map):
label = handle.get_label()
if label and not label.startswith('_'):
if label and label[0] != '_':
handles.append(handle)
labels.append(label)

Expand Down Expand Up @@ -5264,7 +5264,7 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,

patches = []

if histtype.startswith('bar'):
if histtype[:3] == 'bar':
# Save autoscale state for later restoration; turn autoscaling
# off so we can do it all a single time at the end, instead
# of having it done by bar or fill and then having to be redone.
Expand Down Expand Up @@ -5326,7 +5326,7 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
self.set_autoscaley_on(_saved_autoscaley)
self.autoscale_view()

elif histtype.startswith('step'):
elif histtype[:4] == 'step':
# these define the perimeter of the polygon
x = np.zeros(4 * len(bins) - 3, np.float)
y = np.zeros(4 * len(bins) - 3, np.float)
Expand Down
25 changes: 9 additions & 16 deletions lib/matplotlib/figure.py