Thanks to visit codestin.com
Credit goes to github.com

Skip to content

pcolormesh no longer compatible w/ <class 'pandas.core.indexes.datetimes.DatetimeIndex'> #9167

Closed
@jklymak

Description

@jklymak

Bug report

Bug summary

pcolormesh no longer compatible w/ <class 'pandas.core.indexes.datetimes.DatetimeIndex'>

Code for reproduction

import matplotlib.pyplot as plt
import numpy as np
import pandas as pd

time = pd.date_range('2000-01-01', periods=10)
depth = np.arange(20)
data = np.random.rand(20,10)

fig, ax = plt.subplots()
ax.pcolormesh(time, depth, data)
plt.show()

Actual outcome

Traceback (most recent call last):
  File "testPcolorXarray.py", line 10, in <module>
    ax.pcolormesh(time, depth, data)
  File "/Users/jklymak/anaconda3/envs/mpldev3/lib/python3.6/site-packages/matplotlib/__init__.py", line 1710, in inner
    return func(ax, *args, **kwargs)
  File "/Users/jklymak/anaconda3/envs/mpldev3/lib/python3.6/site-packages/matplotlib/axes/_axes.py", line 5631, in pcolormesh
    coords = np.column_stack((X.flat, Y.flat)).astype(float, copy=False)
AttributeError: 'list' object has no attribute 'flat'

Expected outcome

In 2.0.2 this works fine. Blame says it was @QuLogic in axes/_axes.py.

Matplotlib version

  • Operating System: macOS
  • Matplotlib Version: git master...
  • Python Version: 3.6
  • Other Libraries: pandas 0.20.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions