Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cd630f2

Browse filesBrowse files
committed
new examples
1 parent 190a9c7 commit cd630f2
Copy full SHA for cd630f2

File tree

Expand file treeCollapse file tree

1 file changed

+38
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+38
-0
lines changed

‎plotly/widgets/graph_widget.py

Copy file name to clipboardExpand all lines: plotly/widgets/graph_widget.py
+38Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,44 @@ def extend_traces(self, update, indices=(0,), max_points=None):
764764
}
765765
)
766766
```
767+
768+
Example 6 - Update other attributes, like marker colors and
769+
sizes and text
770+
```
771+
# Initialize a plot with some empty attributes
772+
graph.plot([{
773+
'x': [],
774+
'y': [],
775+
'text': [],
776+
'marker': {
777+
'size': [],
778+
'color': []
779+
}
780+
}])
781+
# Append some data into those attributes
782+
graph.extend_traces({
783+
'x': [[1, 2, 3]],
784+
'y': [[10, 20, 30]],
785+
'text': [['A', 'B', 'C']],
786+
'marker.size': [[10, 15, 20]],
787+
'marker.color': [['blue', 'red', 'orange']]
788+
}, indices=[0])
789+
```
790+
791+
Example 7 - Live-update a graph over a few seconds
792+
```
793+
import time
794+
795+
graph.plot([{'x': [], 'y': []}])
796+
for i in range(10):
797+
graph.extend_traces({
798+
'x': [[i]],
799+
'y': [[i]]
800+
}, indices=[0])
801+
802+
time.sleep(0.5)
803+
```
804+
767805
"""
768806
message = {
769807
'task': 'extendTraces',

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.