Python 数据帧绘图标记

Python 数据帧绘图标记,python,pandas,matplotlib,plot,Python,Pandas,Matplotlib,Plot,有没有办法在pandas.DataFrame.plot中设置标记样式?通过设置种类,可以使用所有其他选项。我想要一个带有错误条的标记,但只需要一行带有错误条的标记。如果要通过函数errorbar执行此操作,我将设置fmt='.df.plot将额外的关键字参数传递给基础matplotlib plotting函数。因此, df = pd.DataFrame({'x':np.arange(10), 'y':np.random.randn(10), 'err':n

有没有办法在pandas.DataFrame.plot中设置标记样式?通过设置种类,可以使用所有其他选项。我想要一个带有错误条的标记,但只需要一行带有错误条的标记。如果要通过函数errorbar执行此操作,我将设置fmt='.

df.plot
将额外的关键字参数传递给基础matplotlib plotting函数。因此,

df = pd.DataFrame({'x':np.arange(10), 'y':np.random.randn(10), 
                   'err':np.random.randn(10)})
df.plot('x', 'y', yerr='err', fmt='.')
屈服


OP没有指定它,但它取决于您是尝试绘制数据帧还是一个系列

绘制数据帧 通过@unutbu重用示例:

from numpy import arange, random
import pandas as pd
df = pd.DataFrame({'x': arange(10), 'y': random.randn(10), 'err': random.randn(10)})
df.plot('x', 'y', yerr='err', fmt='.')
在数据帧中绘制序列 这次有点不同:

df.y.plot(fmt='.')
AttributeError: Unknown property fmt
你需要:

df.y.plot(style='.')

具有
样式的数据帧行为
如果将
style
传递给
DataFrame.plot
,则“什么也不发生”:


这可能不是你想要的。

很抱歉,我发布了一个答案,然后删除了它,但它是
df.plot(style='))
你想要什么?
df.plot('x', 'y', yerr='err', style='.')