Skip to content

Commit 1748f63

Browse files
authored
Merge pull request #2208 from plotly/update_bug_patch2
fixing the bug of update_ methods
2 parents 4a7465c + 0960f4c commit 1748f63

File tree

4 files changed

+20
-7
lines changed

4 files changed

+20
-7
lines changed

Diff for: packages/python/plotly/codegen/figure.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ def for_each_{method_prefix}{singular_name}(
473473
474474
def update_{method_prefix}{plural_name}(
475475
self,
476-
patch,
476+
patch=None,
477477
selector=None,
478478
row=None,
479479
col=None,

Diff for: packages/python/plotly/plotly/graph_objs/_figure.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -17450,7 +17450,7 @@ def for_each_annotation(
1745017450
return self
1745117451

1745217452
def update_annotations(
17453-
self, patch, selector=None, row=None, col=None, secondary_y=None, **kwargs
17453+
self, patch=None, selector=None, row=None, col=None, secondary_y=None, **kwargs
1745417454
):
1745517455
"""
1745617456
Perform a property update operation on all annotations that satisfy the
@@ -17949,7 +17949,7 @@ def for_each_layout_image(
1794917949
return self
1795017950

1795117951
def update_layout_images(
17952-
self, patch, selector=None, row=None, col=None, secondary_y=None, **kwargs
17952+
self, patch=None, selector=None, row=None, col=None, secondary_y=None, **kwargs
1795317953
):
1795417954
"""
1795517955
Perform a property update operation on all images that satisfy the
@@ -18221,7 +18221,7 @@ def for_each_shape(self, fn, selector=None, row=None, col=None, secondary_y=None
1822118221
return self
1822218222

1822318223
def update_shapes(
18224-
self, patch, selector=None, row=None, col=None, secondary_y=None, **kwargs
18224+
self, patch=None, selector=None, row=None, col=None, secondary_y=None, **kwargs
1822518225
):
1822618226
"""
1822718227
Perform a property update operation on all shapes that satisfy the

Diff for: packages/python/plotly/plotly/graph_objs/_figurewidget.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -17450,7 +17450,7 @@ def for_each_annotation(
1745017450
return self
1745117451

1745217452
def update_annotations(
17453-
self, patch, selector=None, row=None, col=None, secondary_y=None, **kwargs
17453+
self, patch=None, selector=None, row=None, col=None, secondary_y=None, **kwargs
1745417454
):
1745517455
"""
1745617456
Perform a property update operation on all annotations that satisfy the
@@ -17949,7 +17949,7 @@ def for_each_layout_image(
1794917949
return self
1795017950

1795117951
def update_layout_images(
17952-
self, patch, selector=None, row=None, col=None, secondary_y=None, **kwargs
17952+
self, patch=None, selector=None, row=None, col=None, secondary_y=None, **kwargs
1795317953
):
1795417954
"""
1795517955
Perform a property update operation on all images that satisfy the
@@ -18221,7 +18221,7 @@ def for_each_shape(self, fn, selector=None, row=None, col=None, secondary_y=None
1822118221
return self
1822218222

1822318223
def update_shapes(
18224-
self, patch, selector=None, row=None, col=None, secondary_y=None, **kwargs
18224+
self, patch=None, selector=None, row=None, col=None, secondary_y=None, **kwargs
1822518225
):
1822618226
"""
1822718227
Perform a property update operation on all shapes that satisfy the

Diff for: packages/python/plotly/plotly/tests/test_core/test_update_objects/test_update_annotations.py

+13
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,10 @@ def test_update_annotations(self):
219219
"annotations", [4], patch=dict(showarrow=False), secondary_y=True
220220
)
221221

222+
def test_annotation_attributes(self):
223+
self.fig.add_annotation(text="this text", yref="paper")
224+
self.fig.update_annotations(text="hi")
225+
222226
def test_update_shapes(self):
223227
(
224228
self.fig.add_shape(opacity=0.1, fillcolor="red")
@@ -237,6 +241,11 @@ def test_update_shapes(self):
237241
self.assert_update("shapes", [2, 5], patch=dict(opacity=0), col=1)
238242
self.assert_update("shapes", [4], patch=dict(opacity=0), secondary_y=True)
239243

244+
def test_shape_attributes(self):
245+
246+
self.fig.add_shape(fillcolor="blue", opacity=0.3)
247+
self.fig.update_shapes(fillcolor="red")
248+
240249
def test_update_images(self):
241250
(
242251
self.fig.add_layout_image(opacity=0.1, source="red")
@@ -254,3 +263,7 @@ def test_update_images(self):
254263
self.assert_update("images", [2, 3, 4], patch=dict(opacity=0), row=1)
255264
self.assert_update("images", [2, 5], patch=dict(opacity=0), col=1)
256265
self.assert_update("images", [4], patch=dict(opacity=0), secondary_y=True)
266+
267+
def test_image_attributes(self):
268+
self.fig.add_layout_image(name="my name", x=1, y=2)
269+
self.fig.update_layout_images(opacity=0.1)

0 commit comments

Comments
 (0)