Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixing the bug of update_ methods #2208

Merged
merged 8 commits into from
Feb 19, 2020
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/python/plotly/plotly/graph_objs/_figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -17450,7 +17450,7 @@ def for_each_annotation(
return self

def update_annotations(
self, patch, selector=None, row=None, col=None, secondary_y=None, **kwargs
self, patch=None, selector=None, row=None, col=None, secondary_y=None, **kwargs
):
"""
Perform a property update operation on all annotations that satisfy the
Expand Down Expand Up @@ -17949,7 +17949,7 @@ def for_each_layout_image(
return self

def update_layout_images(
self, patch, selector=None, row=None, col=None, secondary_y=None, **kwargs
self, patch=None, selector=None, row=None, col=None, secondary_y=None, **kwargs
):
"""
Perform a property update operation on all images that satisfy the
Expand Down Expand Up @@ -18221,7 +18221,7 @@ def for_each_shape(self, fn, selector=None, row=None, col=None, secondary_y=None
return self

def update_shapes(
self, patch, selector=None, row=None, col=None, secondary_y=None, **kwargs
self, patch=None, selector=None, row=None, col=None, secondary_y=None, **kwargs
):
"""
Perform a property update operation on all shapes that satisfy the
Expand Down
6 changes: 3 additions & 3 deletions packages/python/plotly/plotly/graph_objs/_figurewidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -17450,7 +17450,7 @@ def for_each_annotation(
return self

def update_annotations(
self, patch, selector=None, row=None, col=None, secondary_y=None, **kwargs
self, patch=None, selector=None, row=None, col=None, secondary_y=None, **kwargs
):
"""
Perform a property update operation on all annotations that satisfy the
Expand Down Expand Up @@ -17949,7 +17949,7 @@ def for_each_layout_image(
return self

def update_layout_images(
self, patch, selector=None, row=None, col=None, secondary_y=None, **kwargs
self, patch=None, selector=None, row=None, col=None, secondary_y=None, **kwargs
):
"""
Perform a property update operation on all images that satisfy the
Expand Down Expand Up @@ -18221,7 +18221,7 @@ def for_each_shape(self, fn, selector=None, row=None, col=None, secondary_y=None
return self

def update_shapes(
self, patch, selector=None, row=None, col=None, secondary_y=None, **kwargs
self, patch=None, selector=None, row=None, col=None, secondary_y=None, **kwargs
):
"""
Perform a property update operation on all shapes that satisfy the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,10 @@ def test_update_annotations(self):
"annotations", [4], patch=dict(showarrow=False), secondary_y=True
)

def test_annotation_attributes(self):
self.fig.add_annotation(test="this text", yref="paper")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you wanted text="this text" here. (CI fails because test is not valid)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ohh yep!

self.fig.update_annotations(text="hi")

def test_update_shapes(self):
(
self.fig.add_shape(opacity=0.1, fillcolor="red")
Expand All @@ -237,6 +241,11 @@ def test_update_shapes(self):
self.assert_update("shapes", [2, 5], patch=dict(opacity=0), col=1)
self.assert_update("shapes", [4], patch=dict(opacity=0), secondary_y=True)

def test_shape_attributes(self):

self.fig.add_shape(fillcolor='blue', opacity=0.3)
self.fig.update_shapes(fillcolor="red")

def test_update_images(self):
(
self.fig.add_layout_image(opacity=0.1, source="red")
Expand All @@ -254,3 +263,7 @@ def test_update_images(self):
self.assert_update("images", [2, 3, 4], patch=dict(opacity=0), row=1)
self.assert_update("images", [2, 5], patch=dict(opacity=0), col=1)
self.assert_update("images", [4], patch=dict(opacity=0), secondary_y=True)

def test_image_attributes(self):
self.fig.add_layout_image(name='my name', x=1, y=2)
self.fig.update_layout_images(opacity=0.1)