You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
and display plotly figures inline using the `plotly_mimetype` renderer...
129
129
130
130
```python
131
-
import plotly.graph_objectsasgo
132
-
fig =go.Figure(data=go.Bar(y=[2, 3, 1]))
131
+
import plotly.expressaspx
132
+
fig =px.bar(x=["a", "b", "c"], y=[1, 3, 2])
133
133
fig.show()
134
134
```
135
135
136
136
or using `FigureWidget` objects.
137
137
138
138
```python
139
+
import plotly.express as px
140
+
fig = px.bar(x=["a", "b", "c"], y=[1, 3, 2])
141
+
139
142
import plotly.graph_objects as go
140
-
fig= go.FigureWidget(data=go.Bar(y=[2, 3, 1]))
141
-
fig
143
+
fig_widget= go.FigureWidget(fig)
144
+
fig_widget
142
145
```
143
146
144
147
The instructions above apply to JupyterLab 3.x. **For JupyterLab 2 or earlier**, run the following commands to install the required JupyterLab extensions (note that this will require [`node`](https://nodejs.org/) to be installed):
@@ -180,17 +183,20 @@ and display plotly figures inline using the notebook renderer...
180
183
181
184
182
185
```python
183
-
import plotly.graph_objectsasgo
184
-
fig =go.Figure(data=go.Bar(y=[2, 3, 1]))
186
+
import plotly.expressaspx
187
+
fig =px.bar(x=["a", "b", "c"], y=[1, 3, 2])
185
188
fig.show()
186
189
```
187
190
188
191
or using `FigureWidget` objects.
189
192
190
193
```python
194
+
import plotly.express as px
195
+
fig = px.bar(x=["a", "b", "c"], y=[1, 3, 2])
196
+
191
197
import plotly.graph_objects as go
192
-
fig= go.FigureWidget(data=go.Bar(y=[2, 3, 1]))
193
-
fig
198
+
fig_widget= go.FigureWidget(fig)
199
+
fig_widget
194
200
```
195
201
196
202
See [_Displaying Figures in Python_](/python/renderers/) for more information on the renderers framework, and see [_Plotly FigureWidget Overview_](/python/figurewidget/) for more information on using `FigureWidget`.
0 commit comments