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

Cache DOS colours and re-use them #10

Merged
merged 2 commits into from
May 8, 2018
Merged

Cache DOS colours and re-use them #10

merged 2 commits into from
May 8, 2018

Conversation

ajjackson
Copy link
Member

This addresses #8 by ensuring that orbital colours will be consistent across multiplots and between re-plot calls from an interactive notebook.

A dict sumo.plotting.colour_cache is held at the plotting level (as other plots may wish to share this information) and initialised as {}; when the dos_plotter does not find an orbital colour specified in the colours argument it will take the next item from a cycle and update the cache with {element: {orbital: colour}}. To clear the cache and start the colour cycle from the beginning, this module-level variable can be manually reset to {}. This would rarely be necessary: I still recommend that any real colour tweaking should be done by passing a dict or config directly.

Tests are included and currently pass.

@utf
Copy link
Member

utf commented May 8, 2018

Thanks @ajjackson. Just tested this and it works great.

@utf utf merged commit b4a4211 into master May 8, 2018
@utf utf deleted the colour-cache branch August 10, 2018 12:59
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