Skip to content
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

Color histogram with floats #18

Open
wants to merge 24 commits into
base: main
Choose a base branch
from
Open

Conversation

zoccoler
Copy link
Contributor

@zoccoler zoccoler commented May 15, 2024

This adds the possibility to assign an array with floats (like representing some feature) as an overlay to the histogram and to the scatter plot.

  • update documentation
  • check if more tests are needed
  • fix log scale problem for histogram

zoccoler added 4 commits May 10, 2024 15:31
…ion_method and calculates a median histogram to be used as overlay

Also add:
 - histogram_interpolation
- overlay_interpolation
 - overlay_opacity
- overlay_visible
 - calculate_statistic histogram
- array_to_pcolormesh_rgba
@zoccoler zoccoler self-assigned this May 15, 2024
Copy link

codecov bot commented May 16, 2024

Codecov Report

Attention: Patch coverage is 94.32177% with 18 lines in your changes missing coverage. Please review.

Project coverage is 92.19%. Comparing base (d1ebeb4) to head (0153257).
Report is 5 commits behind head on main.

Files Patch % Lines
src/biaplotter/artists.py 93.83% 14 Missing ⚠️
src/biaplotter/colormap.py 78.94% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #18      +/-   ##
==========================================
+ Coverage   90.66%   92.19%   +1.53%     
==========================================
  Files           7        8       +1     
  Lines         621      897     +276     
==========================================
+ Hits          563      827     +264     
- Misses         58       70      +12     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

zoccoler added 10 commits May 16, 2024 08:34
ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.
…default categorical overlay_colormap, set min norm value to non-zero when norm is log
…tion for scatter and histogram for both categorical and continuous colormaps

categorical colormaps only accept linear normalization(log, symlog and centered are ignored in this case)
if data is float with categorical colormap, linear normalization is used

if colormap is continuous, all normalization methods are accepted, but limits may be adjusted
- remove 'normalization_method' parameter from array_to_pcolormesh_rgba
- rename indices_in_above_threshold_patches method to indices_in_patches_above_threshold
- don't draw the overlay if all values are NaN
- initialize self._overlay_visible
@zoccoler zoccoler marked this pull request as ready for review July 26, 2024 14:26
@zoccoler zoccoler requested a review from jo-mueller July 29, 2024 11:58
@zoccoler
Copy link
Contributor Author

Hi @jo-mueller ,

I am adding here the possibility to display the scatter colors or an histogram overlay based o another features column (not just a categorical array with integers, but rather any float array with a continuous colormap - I renamed categorical_colormap to overlay_colormap).

You can get a feeling of the changes by running the Artists notebook again, which I updated.

Of course a histogram overlay completely hides the original histogram, but it may be useful if the user hide and show it quickly or change its opacity for example.

When you get some time, could you please give it a try to check if we can merge this?

@jo-mueller
Copy link
Contributor

Hi @zoccoler ,

sorry for the late reply. I am a bit undecided on this implementation: On the one hand I like the simplicity of this: Simply change the colormap to something continuous, pass a float to the color indices and have your plot colored. On the other hand, it loads the same property (color) with potentially multiple meanings.

In the context of the clusters plotter, it would be hard to use colored scatter points in conjunction with the clustering. As an alternative suggestion: Would you think that it could make sense to forward the coloring done with color_indeces to the marker edge color? The coloring of the points according to a given feature could then still be done with the facecolor and the two colorings wouldn't superseed each other.

Let me know what you think!

@zoccoler
Copy link
Contributor Author

zoccoler commented Aug 9, 2024

Hi @jo-mueller ,

I think we both agree that displaying a feature with different colors is a good enhancement (it also fits the goal of this PR).

Using the edge colors for categories can indeed be a solution, we just have to test if it doesn't look confusing. This wouldn't work for the histogram though.
I was hoping to have some hide/show overlay option, similarly to one showing a labels layer on top of an image layer in napari. That would work for both the histogram and the scatter artists.

I will try to generate some examples for these ideas here, then we can decide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants