diff --git a/Orange/widgets/evaluate/owrocanalysis.py b/Orange/widgets/evaluate/owrocanalysis.py index ebcb2f23699..8c628487391 100644 --- a/Orange/widgets/evaluate/owrocanalysis.py +++ b/Orange/widgets/evaluate/owrocanalysis.py @@ -448,8 +448,10 @@ def _initialize(self, results): names = ["#{}".format(i + 1) for i in range(len(results.predicted))] - self.colors = colorpalette.ColorPaletteGenerator( - len(names), colorbrewer.colorSchemes["qualitative"]["Dark2"]) + scheme = colorbrewer.colorSchemes["qualitative"]["Dark2"] + if len(names) > len(scheme): + scheme = colorpalette.DefaultRGBColors + self.colors = colorpalette.ColorPaletteGenerator(len(names), scheme) self.classifier_names = names self.selected_classifiers = list(range(len(names))) diff --git a/Orange/widgets/evaluate/tests/test_owrocanalysis.py b/Orange/widgets/evaluate/tests/test_owrocanalysis.py index 3d09c879ba2..12378d54bfa 100644 --- a/Orange/widgets/evaluate/tests/test_owrocanalysis.py +++ b/Orange/widgets/evaluate/tests/test_owrocanalysis.py @@ -152,4 +152,25 @@ def test_nan_input(self): self.send_signal("Evaluation Results", res) self.assertTrue(self.widget.Error.invalid_results.is_shown()) self.send_signal("Evaluation Results", None) - self.assertFalse(self.widget.Error.invalid_results.is_shown()) \ No newline at end of file + self.assertFalse(self.widget.Error.invalid_results.is_shown()) + + def test_many_evaluation_results(self): + """ + Now works with more than 9 evaluation results. + GH-2394 + """ + data = Orange.data.Table("iris") + learners = [ + Orange.classification.MajorityLearner(), + Orange.classification.LogisticRegressionLearner(), + Orange.classification.TreeLearner(), + Orange.classification.SVMLearner(), + Orange.classification.KNNLearner(), + Orange.classification.CN2Learner(), + Orange.classification.SGDClassificationLearner(), + Orange.classification.RandomForestLearner(), + Orange.classification.NaiveBayesLearner(), + Orange.classification.SGDClassificationLearner() + ] + res = Orange.evaluation.CrossValidation(data, learners, k=2, store_data=True) + self.send_signal("Evaluation Results", res)