8000 Feature Request: Allow hexbin to use a string for parameter C to refer to column in data (DataFrame) · Issue #18097 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

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

Description

@tdpetrou

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)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0