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

bug: 2D geometry plots didn't take perspective into account. #382

Merged
merged 1 commit into from
Oct 1, 2021

Conversation

pfebrer
Copy link
Contributor

@pfebrer pfebrer commented Sep 30, 2021

This PR addresses the issue raised here on discord.

Perspective wasn't taken into account for drawing atoms in 2D and as a result the atoms on top were just the last atoms in the geometry, not the ones that were actually on top.

Now the perspective is automatically determined by your axes choice. I.e.:

import sisl
import sisl.viz

bilayer = sisl.geom.bilayer(top_atoms="C", bottom_atoms=["B", "N"], stacking="AA")

bilayer.plot(axes="xy")

Shows you the view from the top:
image

and

bilayer.plot(axes="-xy")

Shows you the view from the bottom:
image

This has been added to the documentation. New tests have also been added.

@codecov
Copy link

codecov bot commented Sep 30, 2021

Codecov Report

Merging #382 (6a4e9fb) into master (a4343f3) will decrease coverage by 12.99%.
The diff coverage is 96.36%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master     #382       +/-   ##
===========================================
- Coverage   87.12%   74.13%   -13.00%     
===========================================
  Files         321      321               
  Lines       41895    41933       +38     
===========================================
- Hits        36499    31085     -5414     
- Misses       5396    10848     +5452     
Impacted Files Coverage Δ
sisl/viz/input_fields/dropdown.py 75.29% <80.00%> (-18.61%) ⬇️
sisl/viz/plots/geometry.py 89.76% <100.00%> (-2.43%) ⬇️
sisl/viz/plots/tests/test_geometry.py 99.24% <100.00%> (-0.76%) ⬇️
sisl/viz/backends/plotly/_plots/pdos.py 0.00% <0.00%> (-100.00%) ⬇️
sisl/viz/backends/matplotlib/_plots/pdos.py 0.00% <0.00%> (-100.00%) ⬇️
sisl/viz/backends/plotly/_plots/__init__.py 0.00% <0.00%> (-100.00%) ⬇️
sisl/viz/backends/plotly/_plots/fatbands.py 0.00% <0.00%> (-100.00%) ⬇️
sisl/viz/backends/plotly/_plots/bond_length.py 0.00% <0.00%> (-100.00%) ⬇️
sisl/viz/backends/matplotlib/_plots/__init__.py 0.00% <0.00%> (-100.00%) ⬇️
sisl/viz/backends/matplotlib/_plots/fatbands.py 0.00% <0.00%> (-100.00%) ⬇️
... and 100 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a4343f3...6a4e9fb. Read the comment docs.

@zerothi zerothi merged commit e8860e7 into zerothi:master Oct 1, 2021
@pfebrer pfebrer deleted the 2d_depth branch November 15, 2021 10:59
This pull request was closed.
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