FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Feature Request: Allow hexbin to use a string for parameter C to refer to column in data (DataFrame) · Issue #18097 · matplotlib/matplotlib · GitHub

Repository navigation

Feature Request: Allow hexbin to use a string for parameter C to refer to column in data (DataFrame) #18097

Closed

Description

Feature request

Currently the hexbin function allows for its first two parameters x and y to be strings of data (usually a pandas DataFrame), but not C

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
df = pd.DataFrame(np.random.rand(100000, 3))
df.columns = ['a', 'b', 'c']
plt.hexbin('a', 'b', C='c', data=df)

Results in IndexError: string index out of range

Currently, you must pass in C as a Series/array
plt.hexbin('a', 'b', C=df['c'], data=df)

Activity

  1. jklymak commented on Jul 28, 2020

    Member

    Do we allow the string for other z-data? i.e. pcolormesh or imshow?

  2. timhoffm commented on Jul 28, 2020

    Member

    Yes we do. In fact, for pcolormesh and imshow we allow all parameters, including e.g. cmap - not sure if that's intentional.

    But at least 'C' should be allowed for hexbin.

  3. added this to the v3.4.0 milestone on Jul 28, 2020
  4. added
    API: consistencyConsistency of the matplotlib API, including naming, behavior, defaults, …
    on Jul 28, 2020
  5. tacaswell commented on Jul 29, 2020

    Member

    It working for cmap seems like a mistake...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    API: consistencyConsistency of the matplotlib API, including naming, behavior, defaults, …New feature

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL