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)
Do we allow the string for other z-data? i.e. pcolormesh or imshow?
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.
It working for cmap seems like a mistake...
Activity
jklymak commented on Jul 28, 2020
Do we allow the string for other z-data? i.e. pcolormesh or imshow?
timhoffm commented on Jul 28, 2020
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.
tacaswell commented on Jul 29, 2020
It working for cmap seems like a mistake...