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

Added collections of named colormaps, attribute access #5

Merged
merged 5 commits into from
Sep 25, 2017
Merged

Conversation

jbednar
Copy link
Member

@jbednar jbednar commented Sep 22, 2017

Misc collected fixes/improvements:

  • Renamed inferno to bmy to fix mpl and colorcet names #2.
  • Updated code and notebooks for Python3
  • Added attribute access to dictionaries for convenience.
  • Added dictionaries for the named subset of colormaps, for use in GUI apps.

Example of those last two:

image

@jbednar
Copy link
Member Author

jbednar commented Sep 23, 2017

Also fixes #4, sorting the named dictionaries so that options are in a good order in the above list.

Copy link
Member

@philippjfr philippjfr left a comment

Choose a reason for hiding this comment

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

One small comment otherwise this looks good.

"""Ordered dictionary with attribute access (e.g. for tab completion)"""
def __getattr__(self, name): return self[name]
def __delattr__(self, name): del self[name]
def __setattr__(self, name, value): self[name] = value
Copy link
Member

Choose a reason for hiding this comment

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

Should this also have a __dir__ method for tab completion or would that be too cluttered:

    def __dir__(self): return self.keys()

"""Ordered dictionary with attribute access (e.g. for tab completion)"""
def __getattr__(self, name): return self[name]
def __delattr__(self, name): del self[name]
def __setattr__(self, name, value): self[name] = value
Copy link
Member

Choose a reason for hiding this comment

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

Comment above probably applies more here, a __dir__ might be nice.

Copy link
Member Author

Choose a reason for hiding this comment

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

The first one is the source code for the second one, so sure, I'll add that. Thanks!

@jbednar jbednar merged commit 1de34bb into master Sep 25, 2017
@jbednar jbednar deleted the named branch September 25, 2017 21:34
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.

mpl and colorcet names
2 participants