@@ -71,6 +71,19 @@ def assert_update(
71
71
# Check object unchanged
72
72
self .assertEqual (obj , obj_orig )
73
73
74
+ def test_add_annotation_no_grid (self ):
75
+ # Paper annotation
76
+ fig = go .Figure ()
77
+ fig .add_annotation (text = "A" )
78
+ annot = fig .layout .annotations [- 1 ]
79
+ self .assertEqual (annot .text , "A" )
80
+ self .assertEqual (annot .xref , "paper" )
81
+ self .assertEqual (annot .yref , "paper" )
82
+
83
+ # Not valid to add annotation by row/col
84
+ with self .assertRaisesRegexp (Exception , "make_subplots" ):
85
+ fig .add_annotation (text = "B" , row = 1 , col = 1 )
86
+
74
87
def test_add_annotations (self ):
75
88
# Paper annotation
76
89
self .fig .add_annotation (text = "A" )
@@ -111,6 +124,16 @@ def test_add_annotations(self):
111
124
with self .assertRaisesRegexp (ValueError , "of type polar" ):
112
125
self .fig .add_annotation (text = "D" , row = 2 , col = 2 )
113
126
127
+ def test_select_annotations_no_grid (self ):
128
+ (
129
+ self .fig .add_annotation (text = "A1" , arrowcolor = "red" )
130
+ .add_annotation (text = "A2" , arrowcolor = "blue" )
131
+ .add_annotation (text = "A3" , arrowcolor = "blue" )
132
+ )
133
+ self .assert_selected ("annotations" , [0 , 1 , 2 ])
134
+ self .assert_selected ("annotations" , [0 ], selector = dict (arrowcolor = "red" ))
135
+ self .assert_selected ("annotations" , [1 , 2 ], selector = dict (arrowcolor = "blue" ))
136
+
114
137
def test_select_annotations (self ):
115
138
(
116
139
self .fig .add_annotation (text = "A1" , arrowcolor = "red" )
0 commit comments