Repository navigation
Expand file tree
/
Copy pathannotations.py
More file actions
48 lines (42 loc) · 1.53 KB
/
Copy pathannotations.py
File metadata and controls
48 lines (42 loc) · 1.53 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
import matplotlib.pyplot as plot
from datetime import datetime
from helpers import if_string_convert_to_datetime
class Text:
def __init__(self, jsonDict):
self.fontSize = 12
self.color = 'k'
self.alpha = 1
self.__dict__ = jsonDict
self.x = if_string_convert_to_datetime(self.x)
def plot(self, axes):
plot.text(self.x,
self.y,
self.text,
size=self.fontSize,
alpha=self.alpha,
color=self.color["value"])
class Annotation:
def __init__(self, jsonDict):
self.fontSize = 12
self.color = 'k'
self.alpha = 1
self.__dict__ = jsonDict
self.x = if_string_convert_to_datetime(self.arrow_x)
self.x = if_string_convert_to_datetime(self.text_x)
def plot(self, axes):
plot.annotate(self.text,
xy=(self.arrow_x, self.arrow_y),
xycoords='data',
xytext=(self.text_x, self.text_y),
textcoords='data',
color=self.color["value"],
size=self.fontSize,
alpha=self.alpha,
arrowprops=dict(
linewidth=self.lineWidth,
color=self.color["value"],
alpha=self.alpha,
arrowstyle=self.arrow_style,
connectionstyle='arc3,rad=0',
)
)