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

Fix projected band plot with 2 colour #181

Merged
merged 1 commit into from
Oct 6, 2022
Merged

Fix projected band plot with 2 colour #181

merged 1 commit into from
Oct 6, 2022

Conversation

utf
Copy link
Member

@utf utf commented Oct 6, 2022

Fixes #180

Changed the defaults of colour1, colour2 and colour3 from red, green, blue to red, blue, green to make it easier to reproduce the expected behaviour with 2 colours.

@@ -603,8 +603,8 @@ def get_projected_plot(

# if only two orbitals then just use red and blue
if len(weights) == 2:
weights = np.insert(weights, 1, np.zeros(weights[0].shape), axis=0)
colours = ["#ff0000", "#0000ff"]
weights = np.insert(weights, 2, np.zeros(weights[0].shape), axis=0)
Copy link
Member

Choose a reason for hiding this comment

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

Am I right in thinking it was this insertion index which caused the weird behaviour with custom colours?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah exactly, the weights has shape (n_projections, nbands, nkpoints). We inserted the dummy weights between the two existing weights, so the colours should correspond to the 1st and 3rd colours. But instead we only set 2 colours.

@utf utf merged commit b57113f into master Oct 6, 2022
@ajjackson
Copy link
Member

I spent a few minutes trying to break this and it seems fine.

@utf
Copy link
Member Author

utf commented Oct 6, 2022

Thanks for double checking Adam!

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.

Sumo-bandplot legend color with 2 atoms
2 participants