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

Latest commit

 

History

History
History
111 lines (85 loc) · 2.3 KB

File metadata and controls

111 lines (85 loc) · 2.3 KB
Copy raw file
Download raw file
Outline
Edit and raw actions
jupyter
jupytext kernelspec language_info plotly
notebook_metadata_filter text_representation
all
extension format_name format_version jupytext_version
.md
markdown
1.1
1.1.7
display_name language name
Python 3
python
python3
codemirror_mode file_extension mimetype name nbconvert_exporter pygments_lexer version
name version
ipython
3
.py
text/x-python
python
python
ipython3
3.6.5
description display_as language layout name order page_type permalink thumbnail
Introduction to the new Plotly FigureWidget
chart_events
python
base
Plotly FigureWidget Overview
0
example_index
python/figurewidget/
thumbnail/figurewidget-overview.gif

Create a Simple FigureWidget

Create an empty FigureWidget and then view it.

import plotly.graph_objects as go

f = go.FigureWidget()
f

Add traces or update the layout and then watch the output above update in real time.

f.add_scatter(y=[2, 1, 4, 3]);
f.add_bar(y=[1, 4, 3, 2]);
f.layout.title = 'Hello FigureWidget'

Update the Data and the Layout

# update scatter data
scatter = f.data[0]
scatter.y = [3, 1, 4, 3]
# update bar data
bar = f.data[1]
bar.y = [5, 3, 2, 8]
f.layout.title.text = 'This is a new title'

Construct a FigureWidget from a Figure graph object

A standard Figure object can be passed to the FigureWidget constructor.

import plotly.graph_objects as go

trace = go.Heatmap(z=[[1, 20, 30, 50, 1], [20, 1, 60, 80, 30], [30, 60, 1, -10, 20]],
                   x=['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'],
                   y=['Morning', 'Afternoon', 'Evening'])
data=[trace]
layout = go.Layout(title='Activity Heatmap')

figure = go.Figure(data=data, layout=layout)

f2 = go.FigureWidget(figure)
f2

Reference

See these Jupyter notebooks for even more FigureWidget examples.

help(go.FigureWidget)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.