Repository navigation
[FIX] Scatter Plot: Update axis labels when discrete values change - #7336
raashish1601 wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7336 +/- ##
==========================================
- Coverage 88.98% 88.97% -0.01%
==========================================
Files 337 337
Lines 74598 74601 +3
==========================================
+ Hits 66378 66379 +1
- Misses 8220 8222 +2 🚀 New features to boost your workflow:
|
|
The "Scientific Python nightly wheels" failure is unrelated to this change: the nightly pyqtgraph turned |
|
@raashish1601, thanks. The failed test is indeed caused by an (irresponsible) change in pyqtgraph and would be patched in #7329. The diagnosis and the fix is essentially correct, but I think that it would be better to put the change deeper. The genesis of the problem is such.
We can fix the code in three places:
I would lean towards @markotoplak, @VesnaT, what do you think? |
|
Thanks for the explanation. I'm happy to move the fix into |
Issue
Fixes #7308
Description of changes
When new data has the same values in
Xbut a discrete variable's values are renamed (e.g. the steps in the issue: edit the category names in the file and press Reload), Scatter Plot keeps the old category labels on the axis while the legend shows the new ones.OWDataProjectionWidget.set_dataonly marks the domain as changed whendomain.checksum()differs, and Scatter Plot updates its axes only in that case. The checksum is the domain's hash, and a variable's hash is built from its name, type and compute value, not its values. So renaming the values leaves_domain_invalidatedfalse, the data is not invalidated either (the arrays are equal), andupdate_axesis never called.The domain is now also treated as changed when the values of its discrete variables differ.
Tests:
test_discrete_axis_values_changedsends data with a discrete variable valued("1", "2"), then the same table with values("a", "b"), and checks the x-axis ticks. It fails without the change (the ticks stay1,2) and passes with it.test_owscatterplot.py,test_owlinearprojection.py,test_owradviz.py,test_owfreeviz.pyandtest_owmds.pypass locally (Windows, against the Orange 3.40 wheel with this patch applied, apart from one test in the master copy oftest_owscatterplot.pythat needs a newer graph than 3.40 has).Includes