Repository: biolab/orange3

Issue:
Scatter Plot axes labels not updated automatically
<!--
This is an issue template. Please fill in the relevant details in the
sections below.
Wrap code and verbatim terminal window output into triple backticks, see:
https://help.github.com/articles/basic-writing-and-formatting-syntax/#quoting-code

If you're raising an issue about an add-on (e.g. installed via
Options > Add-ons), raise an issue on the relevant add-on's issue
tracker instead. See: https://github.com/biolab?q=orange3
-->

##### Orange version
<!-- From menu _Help→About→Version_ or code `Orange.version.full_version` -->
3.22.0

##### Expected behavior
Scatter Plot should update axes labels whenever it updates its data.


##### Actual behavior
The axes labels only change when being connected to a new widget. Changing the column names for the input table is not reflected in Scatter Plot.




Discussion:
Could you please provide a screenshot and a minimum example?
![image](https://user-images.githubusercontent.com/50418145/61954700-f828fd80-af93-11e9-9c5c-f6bf940238c8.png)
When I change the names of the ContinuousVariables, it doesn't always update in Scatter Plot. Trying to reproduce this, it sometimes works and sometimes doesn't. I think the labels are only changed if the data is also changed.
![image](https://user-images.githubusercontent.com/50418145/61955051-c9f7ed80-af94-11e9-8c93-7a45817e702e.png)
Above, I've changed "A" to "NEW" but it doesn't change in the graph.
![image](https://user-images.githubusercontent.com/50418145/61955093-dd0abd80-af94-11e9-9670-45349dff0ad0.png)
Here I change the data, and the axes labels are updated.
Yeah, I can confirm. The domain itself is updated (variables are renamed), but the plot doesn't reflect it.

Resolving patch:
diff --git a/Orange/widgets/visualize/owscatterplot.py b/Orange/widgets/visualize/owscatterplot.py
--- a/Orange/widgets/visualize/owscatterplot.py
+++ b/Orange/widgets/visualize/owscatterplot.py
@@ -440,6 +440,9 @@ def handleNewSignals(self):
             self.attr_x, self.attr_y = self.attribute_selection_list[:2]
             self.attribute_selection_list = None
         super().handleNewSignals()
+        if self._domain_invalidated:
+            self.graph.update_axes()
+            self._domain_invalidated = False
         self._vizrank_color_change()
 
     @Inputs.features
diff --git a/Orange/widgets/visualize/utils/widget.py b/Orange/widgets/visualize/utils/widget.py
--- a/Orange/widgets/visualize/utils/widget.py
+++ b/Orange/widgets/visualize/utils/widget.py
@@ -393,6 +393,7 @@ def __init__(self):
         self.subset_indices = None
         self.__pending_selection = self.selection
         self._invalidated = True
+        self._domain_invalidated = True
         self.setup_gui()
 
     # GUI
@@ -446,6 +447,10 @@ def set_data(self, data):
         self._invalidated = not (
             data_existed and self.data is not None and
             array_equal(effective_data.X, self.effective_data.X))
+        self._domain_invalidated = not (
+            data_existed and self.data is not None and
+            effective_data.domain.checksum()
+            == self.effective_data.domain.checksum())
         if self._invalidated:
             self.clear()
         self.enable_controls()


Test patch: