Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Cleanup: sorted, dict iteration, array.{ndim,size}, ...#7549
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes from1 commit
70909c4
7a83fc4
5bfd4b7
1d4192c
39352a8
338f6da
43f2f7c
04062b6
14b47ba
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
sorted()
whereever possible.- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -135,11 +135,8 @@ def plot_figure(style_label=""): | ||
# Setup a list of all available styles, in alphabetical order but | ||
# the `default` and `classic` ones, which will be forced resp. in | ||
# first and second position. | ||
style_list = ['default', 'classic'] + sorted( | ||
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. 👍 | ||
style for style in plt.style.available if style != 'classic') | ||
# Plot a demonstration figure for every available style sheet. | ||
for style_label in style_list: | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -968,9 +968,7 @@ def keys(self): | ||
""" | ||
Return sorted list of keys. | ||
""" | ||
return sorted(self) | ||
def values(self): | ||
""" | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -2365,36 +2365,35 @@ def draw(self, renderer=None, inframe=False): | ||
artists.remove(self._left_title) | ||
artists.remove(self._right_title) | ||
if not self.figure.canvas.is_saving(): | ||
artists = [a for a in artists | ||
if not a.get_animated() or a in self.images] | ||
artists = sorted(artists, key=lambda artist: artist.get_zorder()) | ||
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. Is not 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. I doubt it matters but sure. | ||
# rasterize artists with negative zorder | ||
# if the minimum zorder is negative, start rasterization | ||
rasterization_zorder = self._rasterization_zorder | ||
if (rasterization_zorder is not None and | ||
artistsandartists[0].get_zorder() < rasterization_zorder): | ||
renderer.start_rasterizing() | ||
artists_rasterized = [a for a in artists | ||
if a.get_zorder() < rasterization_zorder] | ||
artists = [a for a in artists | ||
if a.get_zorder() >= rasterization_zorder] | ||
else: | ||
artists_rasterized = [] | ||
# the patch draws the background rectangle -- the frame below | ||
# will draw the edges | ||
if self.axison and self._frameon: | ||
self.patch.draw(renderer) | ||
ifartists_rasterized: | ||
for a inartists_rasterized: | ||
a.draw(renderer) | ||
renderer.stop_rasterizing() | ||
mimage._draw_list_compositing_images(renderer, self,artists) | ||
renderer.close_group('axes') | ||
self._cachedRenderer = renderer | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -951,45 +951,37 @@ def _update_ticks(self, renderer): | ||
""" | ||
interval = self.get_view_interval() | ||
tick_tups =list(self.iter_ticks()) | ||
if self._smart_bounds: | ||
# handle inverted limits | ||
view_low, view_high = min(interval), max(interval) | ||
data_low, data_high = sorted(self.get_data_interval()) | ||
locs = np.sort([ti[1] for ti in tick_tups]) | ||
if data_low <= view_low: | ||
# data extends beyond view, take view as limit | ||
ilow = view_low | ||
else: | ||
# data stops within view, take best tick | ||
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. I understand this condition is probably not necessary, but I guess it could also be 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. In fact it's probably needed, otherwise we may end up trying to get the first or last item of an empty array... | ||
good_locs = locs[locs <= data_low] | ||
if len(good_locs) > 0: | ||
# last tick prior or equal to first data point | ||
ilow = good_locs[-1] | ||
else: | ||
# No ticks (why not?), take first tick | ||
ilow = locs[0] | ||
if data_high >= view_high: | ||
# data extends beyond view, take view as limit | ||
ihigh = view_high | ||
else: | ||
# data stops within view, take best tick | ||
good_locs = locs[locs >= data_high] | ||
if len(good_locs) > 0: | ||
# first tick after or equal to last data point | ||
ihigh = good_locs[0] | ||
else: | ||
# No ticks (why not?), take last tick | ||
ihigh = locs[-1] | ||
tick_tups = [ti for ti in tick_tups if ilow <= ti[1] <= ihigh] | ||
# so that we don't lose ticks on the end, expand out the interval ever | ||
# so slightly. The "ever so slightly" is defined to be the width of a | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -36,9 +36,8 @@ def fn_name(): return sys._getframe(1).f_code.co_name | ||
_debug = False | ||
# Image formats that this backend supports - for FileChooser and print_figure() | ||
IMAGE_FORMAT = sorted(['eps', 'jpg', 'png', 'ps', 'svg'] + ['bmp']) # , 'raw', 'rgb'] | ||
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. Just put 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. Sure, but I'll keep the | ||
IMAGE_FORMAT_DEFAULT = 'png' | ||
class RendererGDK(RendererBase): | ||
Uh oh!
There was an error while loading.Please reload this page.