Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8846762

Browse files
committed
allow option for up to 6 colors to errorbar_plot function
1 parent eebb45f commit 8846762

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

worm_algorithm/utils.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88

99
def errorbar_plot(values, labels, out_file, limits=None, Tc_line=None,
1010
reverse_colors=False):
11-
markers = ['s', 'H', 'd', 'v', 'p']
12-
colors = ['#2A9Df8', '#FF920B', '#65e41d', '#be67ff', '#ff7e79']
13-
markeredgecolors = ['#0256a3', '#ed4c18', '#00B000', '#6633cc', '#ee2324']
11+
markers = ['s', 'H', 'd', 'v', 'p', 'P']
12+
colors = ['#2A9Df8', '#FF920B', '#65e41d', '#be67ff', '#ff7e79', '#959595']
13+
markeredgecolors = ['#0256a3', '#ed4c18', '#00B000', '#6633cc',
14+
'#ee2324','#1c2022']
1415
if reverse_colors:
1516
colors = colors[::-1]
1617
markeredgecolors = markeredgecolors[::-1]
@@ -19,13 +20,17 @@ def errorbar_plot(values, labels, out_file, limits=None, Tc_line=None,
1920
y_values = values['y']
2021
assert x_values.shape == y_values.shape, ('x and y data have different'
2122
+ ' shapes.')
22-
y_err = values['y_err']
2323
fig_labels = labels['fig_labels']
2424
x_label = labels['x_label']
2525
y_label = labels['y_label']
26+
num_graphs = len(fig_labels)
27+
try:
28+
y_err = values['y_err']
29+
except KeyError:
30+
# y_err = num_graphs*[np.zeros(y_values.shape)]
31+
y_err = num_graphs*[0]
2632
x_lim = limits.get('x_lim')
2733
y_lim = limits.get('y_lim')
28-
num_graphs = len(fig_labels)
2934

3035
fig, ax = plt.subplots()
3136
if Tc_line is not None:

0 commit comments

Comments
 (0)