Repository: biolab/orange3

Issue:
ScatterPlotGraph: better expose subset when no color selected
<!-- 
Thanks for taking the time to report a bug!
If you're raising an issue about an add-on (i.e., installed via Options > Add-ons), raise an issue in the relevant add-on's issue tracker instead. See: https://github.com/biolab?q=orange3
To fix the bug, we need to be able to reproduce it. Please answer the following questions to the best of your ability.
-->


**What's wrong?**
<!-- Be specific, clear, and concise. Include screenshots if relevant. -->
<!-- If you're getting an error message, copy it, and enclose it with three backticks (```). -->
When using color to color data points and passing a subset to a point-based visualization, the subset is nicely exposed.
But when using None as color and passing the subset, all the data points are still full, not empty as with color.
<img width="1132" alt="Screenshot 2022-03-30 at 11 57 52" src="https://user-images.githubusercontent.com/12524972/160806434-c7f5904f-3323-40a5-9da0-f491f062202a.png">



**How can we reproduce the problem?** 
<!-- Upload a zip with the .ows file and data. -->
<!-- Describe the steps (open this widget, click there, then add this...) -->
File - tSNE. Pass a data subset. Don't use coloring in t-SNE.



**What's your environment?**
<!-- To find your Orange version, see "Help → About → Version" or `Orange.version.full_version` in code -->
- Operating system: OSX
- Orange version: 3.32.dev
- How you installed Orange: pip



Discussion:

Resolving patch:
diff --git a/Orange/widgets/visualize/owscatterplotgraph.py b/Orange/widgets/visualize/owscatterplotgraph.py
--- a/Orange/widgets/visualize/owscatterplotgraph.py
+++ b/Orange/widgets/visualize/owscatterplotgraph.py
@@ -1064,17 +1064,17 @@ def _get_same_colors(self, subset, color=COLOR_DEFAULT):
         Returns:
             (tuple): a list of pens and list of brushes
         """
-
+        alpha_subset, alpha_unset = self._alpha_for_subsets()
         if subset is not None:
-            colors = [QColor(*color, alpha)
-                      for alpha in self._alpha_for_subsets()]
-            brushes = [QBrush(color) for color in colors]
-            brush = np.where(subset, *brushes)
+            qcolor = QColor(*color, alpha_subset)
+            brush = np.where(subset, QBrush(qcolor), QBrush(QColor(0, 0, 0, 0)))
+            pen = np.where(subset,
+                           _make_pen(qcolor, 1.5),
+                           _make_pen(QColor(*color, alpha_unset), 1.5))
         else:
             qcolor = QColor(*color, self.alpha_value)
             brush = np.full(self.n_shown, QBrush(qcolor))
-        qcolor = QColor(*color, self.alpha_value)
-        pen = [_make_pen(qcolor, 1.5)] * self.n_shown
+            pen = [_make_pen(qcolor, 1.5)] * self.n_shown
         return pen, brush
 
     def _get_continuous_colors(self, c_data, subset):


Test patch:
diff --git a/Orange/widgets/visualize/tests/test_owscatterplotbase.py b/Orange/widgets/visualize/tests/test_owscatterplotbase.py
--- a/Orange/widgets/visualize/tests/test_owscatterplotbase.py
+++ b/Orange/widgets/visualize/tests/test_owscatterplotbase.py
@@ -681,8 +681,14 @@ def test_colors_none(self):
         data = graph.scatterplot_item.data
         self.assertTrue(all(pen.color().hue() == hue for pen in data["pen"]))
         self.assertTrue(all(pen.color().hue() == hue for pen in data["brush"]))
-        self.assertEqual(len(set(map(id, data["pen"]))), 1)
+        self.assertEqual(len(set(map(id, data["pen"]))), 2)
+        self.assertEqual(data["pen"][3].color(), data["pen"][4].color())
+        self.assertNotEqual(data["pen"][4].color().alpha(),
+                            data["pen"][5].color().alpha())
         self.assertEqual(len(set(map(id, data["brush"]))), 2)  # transparent and colored
+        self.assertEqual(data["brush"][3].color(), data["brush"][4].color())
+        self.assertNotEqual(data["brush"][4].color().alpha(),
+                            data["brush"][5].color().alpha())
 
     def test_colors_update_legend_and_density(self):
         graph = self.graph