Skip to content

Fix width in fat bands#1340

Draft
t-reents wants to merge 3 commits into
aiidalab:mainfrom
t-reents:fix/fat-bands-width
Draft

Fix width in fat bands#1340
t-reents wants to merge 3 commits into
aiidalab:mainfrom
t-reents:fix/fat-bands-width

Conversation

@t-reents
Copy link
Copy Markdown
Collaborator

Currently, we determine the line width to display the projectability in a fat bands plot simply by shifting the bands up and down by +- band_width / 2.
However, this is not correct as one would need to perform the shift perpendicular to the band. As an example, a vertical band would have 0 width in the current version, independent of the projectability.

I discussed with @edan-bainglass @eimrek at some point that it might be possible to use the gradients to plot the correct fat bands. While the general idea would work, I realized during the last days that this approach doesn't work that smoothly and produces visual artefacts, e.g., in areas with a strong curvature. Hence, I move to a simple scatter plot in this version to visualize the projections, which is also used in other tools and much simpler than the actual filled line plots with varying width, as outlined above. Moreover, it avoids recalculating the projections and so may improve performance.

Also pinging @AndresOrtegaGuerrero

Happy to discuss this further, just wanted to open it already so that it can be used for the paper.

new version

image

old version

image

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 29, 2025

Codecov Report

❌ Patch coverage is 50.00000% with 5 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@c369086). Learn more about missing BASE report.
⚠️ Report is 81 commits behind head on main.

Files with missing lines Patch % Lines
...rc/aiidalab_qe/common/bands_pdos/bandpdosplotly.py 42.85% 4 Missing ⚠️
src/aiidalab_qe/common/bands_pdos/model.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1340   +/-   ##
=======================================
  Coverage        ?   72.34%           
=======================================
  Files           ?       99           
  Lines           ?     6880           
  Branches        ?        0           
=======================================
  Hits            ?     4977           
  Misses          ?     1903           
  Partials        ?        0           
Flag Coverage Δ
python-3.11 72.32% <50.00%> (?)
python-3.9 72.37% <50.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

@AndresOrtegaGuerrero
Copy link
Copy Markdown
Member

Hi @t-reents,
I was wondering if there's a way to improve the appearance of the plot or to smooth the data. When comparing the figures, I do see some projections along the vertical lines (Old version). However, the way the plot currently displays (New) what look like "gaps" is a bit confusing—it gives the impression that there are no projections in certain parts of the bands. I think it would be helpful to clarify or resolve this before moving forward.

@t-reents
Copy link
Copy Markdown
Collaborator Author

Yes, either we simply interpolate the projections to always have a certain density of points, which is implicitly done when plotting the projections as filled bands in the previous version, or we adjust the minimum size of the individual points.

There is anyway one additional aspect: When moving to a scatter plot, the slider should no longer have explicit units, as we only change the size of the markers which is defined in pixels. We don't have an easy way to express this in data units.

@AndresOrtegaGuerrero
Copy link
Copy Markdown
Member

Then i guess before that is solve , the best is to set this one as a draft

@t-reents t-reents marked this pull request as draft July 21, 2025 13:12
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