Skip to content

Conversation

jo-mueller
Copy link
Collaborator

Fixes #444

@zoccoler PR to fix what I noticed when I prepared the slides for the course. For a large number of points, the point sizes are waaaay too large to discern any clusters in the data. I added UI options to set the point size manually and to enable/disable the frame highlighting. In doing so, I also streamlined the handling of the advanced option's appearance/dissapearance a bit.

Future work may include some clever settings for points' edge width (the linewidth property) - it can happen, that for small point sizes, the face of a point is completely invisible due to the comparatively large border ^^"

Copilot description

This pull request introduces several enhancements and refactors to the napari_clusters_plotter package, focusing on improving scatter plot functionality, adding advanced options for frame highlighting and point size adjustments, and restructuring the UI for better usability. Additionally, it includes updates to the test suite to ensure the new features are properly validated.

Enhancements to Scatter Plot Functionality:

  • Added support for frame highlighting and point size adjustments in scatter plots, controlled via new UI elements (checkBox_frame_highlighting and spinBox_point_size). These settings dynamically update the alpha and size of points based on the current frame and user-defined values. (src/napari_clusters_plotter/_new_plotter_widget.py, [1] [2] [3]

  • Introduced new properties (scatter_point_size and frame_highlighting_activated) to encapsulate scatter plot settings, enabling easier access and modification. (src/napari_clusters_plotter/_new_plotter_widget.py, src/napari_clusters_plotter/_new_plotter_widget.pyR381-R425)

UI Improvements:

  • Restructured the UI to include dedicated containers for scatter and histogram settings (scatter_settings_container and bins_settings_container), improving clarity and usability. (src/napari_clusters_plotter/plotter_inputs.ui, [1] [2]

  • Adjusted the default visibility and layout of UI elements to better reflect the active plot type, ensuring relevant controls are displayed contextually. (src/napari_clusters_plotter/plotter_inputs.ui, src/napari_clusters_plotter/plotter_inputs.uiL210-L261)

Refactoring and Code Simplification:

  • Removed the _handle_advanced_options_widget_visibility method, simplifying visibility control logic by integrating it directly into relevant methods such as _replot and _on_plot_type_changed. (src/napari_clusters_plotter/_new_plotter_widget.py, [1] [2]

Test Suite Updates:

@jo-mueller jo-mueller added the enhancement New feature or request label Jul 2, 2025
Copy link

codecov bot commented Jul 2, 2025

Codecov Report

Attention: Patch coverage is 92.98246% with 4 lines in your changes missing coverage. Please review.

Project coverage is 88.78%. Comparing base (5c3d592) to head (479a714).

Files with missing lines Patch % Lines
src/napari_clusters_plotter/_new_plotter_widget.py 89.18% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #445      +/-   ##
==========================================
+ Coverage   88.13%   88.78%   +0.65%     
==========================================
  Files          11       11              
  Lines        1079     1115      +36     
==========================================
+ Hits          951      990      +39     
+ Misses        128      125       -3     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jo-mueller jo-mueller requested a review from Copilot July 2, 2025 21:37
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the scatter plot UX by adding manual point-size and frame-highlighting controls, refactors advanced-options visibility logic into relevant methods, and updates docs and tests to cover the new features.

  • Added UI controls (spinBox_point_size, checkBox_frame_highlighting) and corresponding properties/callbacks for scatter plots
  • Streamlined advanced-options visibility by removing a dedicated handler and integrating it into _replot, _on_plot_type_changed, etc.
  • Updated tests to assert on new size/alpha behavior and refreshed documentation screenshots and descriptions

Reviewed Changes

Copilot reviewed 4 out of 7 changed files in this pull request and generated 4 comments.

File Description
src/napari_clusters_plotter/plotter_inputs.ui Added scatter & histogram control group boxes and adjusted tab index
src/napari_clusters_plotter/_new_plotter_widget.py Introduced scatter_point_size/frame_highlighting_activated props, callbacks, and default factors
src/napari_clusters_plotter/_tests/test_plotter.py Extended tests for scatter advanced options
docs/usage/plotter_widget.md Updated screenshot reference and listed new controls
Comments suppressed due to low confidence (1)

src/napari_clusters_plotter/plotter_inputs.ui:125

  • There's a typo in the tooltip: 'enale' should be 'enable'.
             <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Continuous colormap to display a feature as colors over plotted data.&lt;/p&gt;&lt;p&gt;Use the eye button in the plotter controls to hide/show the overlay colors.&lt;/p&gt;&lt;p&gt;To enale this, select a non-categorical feature in the &lt;span style=&quot; font-weight:600;&quot;&gt;Hue&lt;/span&gt; Combobox.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>

Depending on which plot type is selected, some additional options are available:

11. For `SCATTER` plot:
- Enable the time-frame highlighting. This make give out-of-frame points a different alpha and size, making them appear slightly more transparent and smaller. This is useful to visualize the current time frame in a time-series dataset. To make use of this, enusre that the measurements in the layer's `layer.features` dataframe contain a `frame` column, which is used to determine the current time frame.
Copy link

Copilot AI Jul 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Grammar typo: 'This make give out-of-frame' should be 'This will make out-of-frame' or 'Makes out-of-frame'.

Suggested change
- Enable the time-frame highlighting. This make give out-of-frame points a different alpha and size, making them appear slightly more transparent and smaller. This is useful to visualize the current time frame in a time-series dataset. To make use of this, enusre that the measurements in the layer's `layer.features` dataframe contain a `frame` column, which is used to determine the current time frame.
- Enable the time-frame highlighting. This will make out-of-frame points have a different alpha and size, making them appear slightly more transparent and smaller. This is useful to visualize the current time frame in a time-series dataset. To make use of this, ensure that the measurements in the layer's `layer.features` dataframe contain a `frame` column, which is used to determine the current time frame.

Copilot uses AI. Check for mistakes.

jo-mueller and others added 4 commits July 2, 2025 23:49
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@jo-mueller
Copy link
Collaborator Author

THis PR depends on BiAPoL/biaplotter#64 and BiAPoL/biaplotter#66 to be released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve UX for scatter plots

1 participant