Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix/histograms don't match the scatter plot #80
Fix/histograms don't match the scatter plot #80
Changes from 4 commits
733e436
46544c3
6f39210
6f7b892
4399f59
0552877
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is something fishy to me about this filter call, too. is this just supposed to be a check for whether the array contains all null values? (what if it contains all 0 values?) filter seems to create a whole new array, which means we're doing a very unnecessary data copy here. I feel like this and the syncNullValues could be combined into something more efficient.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good point about all 0 values (and the data copy). I should be able combine the two operations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realize it is outside the scope of the PR but I made the mistake of trying to actually understand the code. Hopefully it is not too involved to clean it up. :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just all whitespace change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like it should be happening in the selector that gets the values for the histogram? What's the reason for doing it this way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it in a util function? so it's easier to test 😅 Or were you asking another question?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The values that go in the histograms are just
mainPlotData.x
andmainPlotData.y
,cell-feature-explorer/src/containers/MainPlotContainer/selectors.ts
Line 258 in f313c72
getMainPlotData
selector.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah sorry, I didn't read this carefully enough and thought the util function was being called from a component, not another selector. What I meant was I was thinking we'd have a "getHistogramData" selector that fed into the main plot data, but this works. I think you could keep the function in the selector file since it's only being called from there, and it doesn't seem like a general function other modules are going to use.
Generally there is the convention that anytime you're reading from state, like in a selector, you make a copy instead of directly manipulating the data, and you only manipulate the data through actions. I can't think of any issue this code as is would cause (you could even make the case we should just be doing this before we save the data in state) but it does look odd to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My only concern here is that you are actually modifying the array. Is that ok? Are you actually changing data that shouldn't be changed? Like if you have (x=3,y=null) and you change the 3 to a null but then want to plot a different Y feature, is the x=3 gone forever?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha, I'll rework this to make copies of the data instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should say that I am not aware of whether you are already starting with copies when you actually arrive in this function, or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, not starting with copies. But I should. Either that or produce copies in here