Skip to content

Commit c2347d1

Browse files
committed
Add 'default' and group styles ~ in lexicographic order
1 parent cea7f28 commit c2347d1

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

examples/style_sheets/style_sheets_reference.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,17 @@ def plot_figure(style_label=None):
134134

135135
if __name__ == "__main__":
136136

137+
# Setup a list of all available styles, in alphabetical order but
138+
# the `default` and `classic` ones, which will be forced resp. in
139+
# first and second position.
140+
style_list = list(plt.style.available) # *new* list: avoids side effects.
141+
style_list.remove('classic') # `classic` is in the list: first remove it.
142+
style_list.sort()
143+
style_list.insert(0, u'default')
144+
style_list.insert(1, u'classic')
145+
137146
# Plot a demonstration figure for every available style sheet.
138-
for style_label in plt.style.available:
147+
for style_label in style_list:
139148
with plt.style.context(style_label):
140149
fig = plot_figure(style_label=style_label)
141150

0 commit comments

Comments
 (0)