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 4eed225

Browse filesBrowse files
Merge pull request plotly#3523 from plotly/pre5.52
px-first getting-started/readme
2 parents d281683 + 7aaaaff commit 4eed225
Copy full SHA for 4eed225

File tree

Expand file treeCollapse file tree

2 files changed

+18
-15
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+18
-15
lines changed

‎README.md

Copy file name to clipboardExpand all lines: README.md
+2-5Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,8 @@
3838
Inside [Jupyter](https://jupyter.org/install) (installable with `pip install "jupyterlab>=3" "ipywidgets>=7.6"`):
3939

4040
```python
41-
import plotly.graph_objects as go
42-
fig = go.Figure()
43-
fig.add_trace(go.Scatter(y=[2, 1, 4, 3]))
44-
fig.add_trace(go.Bar(y=[1, 4, 3, 2]))
45-
fig.update_layout(title = 'Hello Figure')
41+
import plotly.express as px
42+
fig = px.bar(x=["a", "b", "c"], y=[1, 3, 2])
4643
fig.show()
4744
```
4845

‎doc/python/getting-started.md

Copy file name to clipboardExpand all lines: doc/python/getting-started.md
+16-10Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ This package contains everything you need to write figures to standalone HTML fi
7272
7373

7474
```python
75-
import plotly.graph_objects as go
76-
fig = go.Figure(data=go.Bar(y=[2, 3, 1]))
75+
import plotly.express as px
76+
fig = px.bar(x=["a", "b", "c"], y=[1, 3, 2])
7777
fig.write_html('first_figure.html', auto_open=True)
7878
```
7979

@@ -128,17 +128,20 @@ $ jupyter lab
128128
and display plotly figures inline using the `plotly_mimetype` renderer...
129129

130130
```python
131-
import plotly.graph_objects as go
132-
fig = go.Figure(data=go.Bar(y=[2, 3, 1]))
131+
import plotly.express as px
132+
fig = px.bar(x=["a", "b", "c"], y=[1, 3, 2])
133133
fig.show()
134134
```
135135

136136
or using `FigureWidget` objects.
137137

138138
```python
139+
import plotly.express as px
140+
fig = px.bar(x=["a", "b", "c"], y=[1, 3, 2])
141+
139142
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
142145
```
143146

144147
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...
180183

181184

182185
```python
183-
import plotly.graph_objects as go
184-
fig = go.Figure(data=go.Bar(y=[2, 3, 1]))
186+
import plotly.express as px
187+
fig = px.bar(x=["a", "b", "c"], y=[1, 3, 2])
185188
fig.show()
186189
```
187190

188191
or using `FigureWidget` objects.
189192

190193
```python
194+
import plotly.express as px
195+
fig = px.bar(x=["a", "b", "c"], y=[1, 3, 2])
196+
191197
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
194200
```
195201

196202
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

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