Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Enh mappable remapper#4490

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
Closed
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
MNT: settle on using np.asarray on input
Use `np.asarray` to ensure that the contents of the mapping are suitableto pass into mpl functions.  This allows these functions to work withboth DataFrames, with dict-likes of lists/arrays and (presumably) withxray objects.
  • Loading branch information
@tacaswell
tacaswell committedJun 7, 2015
commit08edd2246c083a3535ae9dccd7c30b4e8f922df9
8 changes: 4 additions & 4 deletionslib/matplotlib/cbook.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2460,7 +2460,7 @@ def inner(ax, data, *args, **kwargs):
raise ValueError(("Trying to map a column ({1} -> {0}) "
"on to a passed in "
"keyword arg ({0})").format(k, v))
kwargs[k] = data[v].values
kwargs[k] =np.asarray(data[v])
return func(ax, *args, **kwargs)

return inner
Expand DownExpand Up@@ -2512,7 +2512,7 @@ def mappable_args_decorator(func, map_targets):
"""
@wraps(func)
def inner(ax, data, *args, **kwargs):
args = tuple(data[k] for k in map_targets) + args
args = tuple(np.asarray(data[k]) for k in map_targets) + args
return func(ax, *args, **kwargs)

return inner
Expand All@@ -2524,12 +2524,12 @@ def apply_kwargs_mapping(ax, func, data, map_targets, *args, **kwargs):
raise ValueError(("Trying to map a column ({1} -> {0}) "
"on to a passed in "
"keyword arg ({0})").format(k, v))
kwargs[k] = data[v].values
kwargs[k] =np.asarary(data[v])
return func(ax, *args, **kwargs)


def apply_args_mapping(ax, func, data, map_targets, *args, **kwargs):
args = tuple(data[k] for k in map_targets) + args
args = tuple(np.asarray(data[k]) for k in map_targets) + args
return func(ax, *args, **kwargs)


Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp