以下是我针对这个包编写的代码:
- #plot 1 - barplot
- # **note** - the layout lines do nothing and trip no errors
- data = [go.Bar(x=team_ave_df.team,
- y=team_ave_df.turnovers_per_mp)]
-
- layout = go.Layout(
-
- title=go.layout.Title(
- text='Turnovers per Minute by Team',
- xref='paper',
- x=0
- ),
-
- xaxis=go.layout.XAxis(
- title = go.layout.xaxis.Title(
- text='Team',
- font=dict(
- family='Courier New, monospace',
- size=18,
- color='#7f7f7f'
- )
- )
- ),
-
- yaxis=go.layout.YAxis(
- title = go.layout.yaxis.Title(
- text='Average Turnovers/Minute',
- font=dict(
- family='Courier New, monospace',
- size=18,
- color='#7f7f7f'
- )
- )
- ),
-
- autosize=True,
- hovermode='closest')
-
- py.iplot(figure_or_data=data, layoutlayout=layout, filename='jupyter-plot', sharing='public', fileopt='overwrite')
-
-
-
- #plot 2 - attempt at a scatterplot
- data = [go.Scatter(x=player_year.minutes_played,
- y=player_year.salary,
- marker=go.scatter.Marker(color='red',
- size=3))]
-
- layout = go.Layout(title="test",
- xaxis=dict(title='why'),
- yaxis=dict(title='plotly'))
-
- py.iplot(figure_or_data=data, layoutlayout=layout, filename='jupyter-plot2', sharing='public')
-
- [Image: image.png]
表示不同 NBA 球队每分钟平均失误数的条形图
表示薪水和在 NBA 的打球时间之间关系的散点图 (编辑:西安站长网)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|