pandas和matplotlib错误:“AxesHostAxes”对象没有属性“rowNum”

2024-04-19 04:54:33 发布

您现在位置:Python中文网/ 问答频道 /正文

我尝试使用pandas DataFrame和matplotlib inset axis绘制图形,但无法使其工作。这只发生在我将pandas包更新到0.16.2版本之后,现在我总是收到以下错误消息:

“AxesHostAxes”对象没有属性“rowNum”

以下是我的代码:

    fig, ax = plt.subplots(figsize=(6,4))

    mydata.plot(ax = ax, color = colors[1])
    axins =  inset_axes(ax,
                            width="55%", # width = 30% of parent_bbox
                            height="50%", # height : 1 inch
                            loc = 4,

            )
    mydata[:151].plot(ax = axins, color = colors[1])

mydata是熊猫数据帧。即使有错误消息,我还是得到了下面的图表。有人知道怎么解决这个问题吗? Output of the graph


Tags: 消息dataframepandasplotmatplotlib错误axwidth