在这里,我试图用plotly绘制交互式图表,因为输入是pandas dataframe。你知道吗
因为数据框有大量的数据集,所以图表看起来非常简洁,而且格式不可读。我只想从中间向左画10个,向右画10个。你知道吗
我的要求是选择熊猫数据帧的中间部分,然后选择10个上下索引进行绘图。 如何使用python实现此操作。 下面是示例代码。这里x在三个记录道之间共享,数据系列是y=df['OI']、y=df['pOI']、y=df['cchangeoi']
X轴是日期,y轴是某个范围内的数据。你知道吗
def groupstacked_bar_chart_exp(df,SCRIPTCODE):
trace1 = go.Bar(
#x=stock_opt_pe.index
base =0,
width=0.4,
offset=0.0,
x=df['Sprice'],
y=df['OI'],
name='OI',
orientation = 'v',
marker = dict(
color = 'rgba(102,51,255,1)',
#line = dict(
#color = 'rgba(246, 246, 246, 1.0)',
#color = 'rgb(60, 60, 60)',
#width = 0)
)
)
trace2 = go.Bar(
#x=stock_opt_pe.index
width=0.4,
offset=-0.4,
x=df['SPrice'],
y=df['pOI'],
name='pOI',
orientation = 'v',
marker = dict(
color = 'rgba(102,0,153,1)',
#line = dict(
#color = 'rgba(246, 246, 246, 1.0)',
#color = 'rgb(60, 60, 60)',
#width = 0)
)
)
trace3 = go.Bar(
#x=stock_opt_pe.index
width=0.4,
offset=-0.4,
x=df['SPrice'],
y=df['cchangeoi'],
name='cchangeoi',
orientation = 'v',
marker = dict(
color = 'rgba(255,255,0,1)',
#line = dict(
#color = 'rgba(246, 246, 246, 1.0)',
#color = 'rgb(60, 60, 60)',
#width = 0)
)
)
odata = [trace1,trace2,trace3]
目前没有回答
相关问题 更多 >
编程相关推荐