-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpoints-plot.py
More file actions
54 lines (46 loc) · 1.13 KB
/
points-plot.py
File metadata and controls
54 lines (46 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
from fpl import FplCurrent,FplHistory
import numpy as np
import plotly.graph_objects as go
team = FplCurrent(7612489)
hisory = FplHistory(team.managerID, 1)
weeks_played = hisory.gameWeeks_played
gameweeks = np.arange(1, weeks_played + 1)
points = np.concatenate(
np.array(
[[FplHistory(team.managerID, n).points] for n in range(1, weeks_played + 1)]
)
)
hover_text = [
f"Gameweek {gameweek}<br>{point} points"
for gameweek, point in zip(gameweeks, points)
]
fig = go.Figure(
data=go.Bar(x=gameweeks, y=points, hovertext=hover_text, hoverinfo="text")
)
fig.update_layout(
title={
"text": "Points per Gameweek Plot",
"x": 0.5,
"xanchor": "center",
"font": {
"family": "Arial, sans-serif",
"size": 24,
},
},
xaxis_title={
"text" : "Gameweek",
"font": {
"family": "Arial, sans-serif",
"size": 18
},
},
yaxis_title={
"text" : "Points",
"font": {
"family": "Arial, sans-serif",
"size": 18
},
},
template = "plotly_dark"
)
fig.show()