-
Notifications
You must be signed in to change notification settings - Fork 10
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
Add defaults to arguments #11
Open
ljwolf
wants to merge
10
commits into
pysal:master
Choose a base branch
from
ljwolf:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
6bf1e5a
make sane defaults for classifications and palette
ljwolf 41ee7b1
allow passthrough on positional subaxis
ljwolf fd236cb
add stub for test of locspec
ljwolf a517355
Merge branch 'master' of github.com:pysal/legendgram
ljwolf 48ab0d1
add defaults to arguments
ljwolf af2159e
rename examples to notebooks
ljwolf 5201434
Update legendgram/legendgram.py
ljwolf 60e6e47
provide cmap used on last plot
jGaboardi 40d861e
remove geoplot from tests – gh #7
jGaboardi 2ba2c91
ensure all tests passing
jGaboardi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I am missing something here, but why do you use None and an if clause for a default? You could just directly assign 'viridis' to the parameter in the api. This way users also see how the input out to look like?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious maybe I can learn something :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question! I had intended to somehow detect the current matplotlib palette and use that if
pal=None
. But, I couldn't quite figure out how to do that. So, I deleted the exploration in thisif
branch & simply usedpal = 'viridis'
.Ideally, you'd use
pal=None
andif pal is None
, somehow check what colormap the user is using currently. I don't quite know how to do that.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, yeah that sounds great!
do you think something like
'''
fig, ax = plt.subplots()
im = ax.imshow(a, cmap="viridis")
cm = im.get_cmap()
print(cm.name)
"""
through
'Matplotlib.cm.get_cmap()' could work?
Happy to leave this as is and deal with it later. Maybe add a note, so others can keep finding solutions? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, well that's simole... how I missed it idk.
No reason to merge an incomplete if that works! I'll take a look tomorrow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ljwolf Is this still under consideration? I put together a small gist demonstrating a helper function built on top of @slumnitz's idea. Basically, it uses the most recent colormap of an image, if the axis has any associated images. Otherwise, it defaults to viridis.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, totally! push on top of this so that it updates!