Commit ccbe0cb1 authored by Pavel KORSHUNOV's avatar Pavel KORSHUNOV

Colors for several plots, corrected

parent 0c8f9402
......@@ -82,6 +82,7 @@ class Plotter(baselib.Plotter):
args = []
label = []
kwargs = []
single_experiment = len(inputs) == 1
......
......@@ -56,11 +56,11 @@ class Plotter(baselib.Plotter):
self.ylabel = "False Negatives (False Non-Match Rate), in %"
# These are the "Tableau 20" colors as RGB.
self.tableau20 = [(31.119.180), (152.223.138), (140.86.75), (199.199.199),
(174.199.232), (214.39.40), (196.156.148), (188.189.34),
(255.127.14), (255.152.150), (227.119.194), (219.219.141),
(255.187.120), (148.103.189), (247.182.210), (23.190.207),
(44.160.44), (197.176.213), (127.127.127), (158.218.229)]
self.tableau20 = [(31,119,180), (152,223,138), (140,86,75), (199,199,199),
(174,199,232), (214,39,40), (196,156,148), (188,189,34),
(255,127,14), (255,152,150), (227,119,194), (219,219,141),
(255,187,120), (148,103,189), (247,182,210), (23,190,207),
(44,160,44), (197,176,213), (127,127,127), (158,218,229)]
# Scale the RGB values to the [0, 1] range, which is the format matplotlib accepts.
for i in range(len(self.tableau20)):
r, g, b = self.tableau20[i]
......@@ -71,7 +71,6 @@ class Plotter(baselib.Plotter):
def process(self, inputs):
fig, ax = super(Plotter, self).prepare_canvas()
super(Plotter, self).apply_parameters(ax)
......@@ -83,17 +82,17 @@ class Plotter(baselib.Plotter):
ax.set_xlim((self.xlim_left,self.xlim_right))
ax.set_ylim((self.ylim_bottom,self.ylim_top))
args = []
label = []
label = ""
kwargs = {}
single_experiment = len(inputs) == 1
number_of_positives = []
number_of_negatives = []
n_lines = 0
for xp_label, xp_data in inputs:
for scatter in xp_data.data:
args = []
# the data
x = scatter.false_positives
if self.det:
......@@ -110,25 +109,27 @@ class Plotter(baselib.Plotter):
# the label
if self.label: #gets the label from user overwritten input
label.append(self.label[len(label)%len(self.label)])
label = self.label[n_lines%len(self.label)]
else: #make-up label
if single_experiment:
label.append(scatter.label)
label = scatter.label
else:
text = [k for k in (xp_label, scatter.label) if k]
label.append('-'.join(text))
label = '-'.join(text)
# the line attributes
if self.line_attributes:
args.append(self.line_attributes[len(label)%len(self.line_attributes)])
args.append(self.line_attributes[n_lines%len(self.line_attributes)])
else:
args.append('color')
args.append(self.tableau20[len(label) % len(self.tableau20)])
kwargs['color'] = self.tableau20[n_lines % len(self.tableau20)]
lines = ax.plot(*args)
if len(lines) > 1:
ax.legend(lines, label, loc=self.loc, fontsize=self.legend_fontsize, fancybox=True, framealpha=0.75)
kwargs['label'] = label
n_lines += 1
ax.plot(*args, **kwargs)
if n_lines > 1:
ax.legend(loc=self.loc, fontsize=self.legend_fontsize, fancybox=True, framealpha=0.5)
# reset log axis
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment