Skip to content

Commit

Permalink
Merge pull request #3523 from plotly/pre5.52
Browse files Browse the repository at this point in the history
px-first getting-started/readme
  • Loading branch information
nicolaskruchten authored Dec 21, 2021
2 parents d281683 + 7aaaaff commit 4eed225
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,8 @@
Inside [Jupyter](https://jupyter.org/install) (installable with `pip install "jupyterlab>=3" "ipywidgets>=7.6"`):

```python
import plotly.graph_objects as go
fig = go.Figure()
fig.add_trace(go.Scatter(y=[2, 1, 4, 3]))
fig.add_trace(go.Bar(y=[1, 4, 3, 2]))
fig.update_layout(title = 'Hello Figure')
import plotly.express as px
fig = px.bar(x=["a", "b", "c"], y=[1, 3, 2])
fig.show()
```

Expand Down
26 changes: 16 additions & 10 deletions doc/python/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ This package contains everything you need to write figures to standalone HTML fi

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

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

```python
import plotly.graph_objects as go
fig = go.Figure(data=go.Bar(y=[2, 3, 1]))
import plotly.express as px
fig = px.bar(x=["a", "b", "c"], y=[1, 3, 2])
fig.show()
```

or using `FigureWidget` objects.

```python
import plotly.express as px
fig = px.bar(x=["a", "b", "c"], y=[1, 3, 2])

import plotly.graph_objects as go
fig = go.FigureWidget(data=go.Bar(y=[2, 3, 1]))
fig
fig_widget = go.FigureWidget(fig)
fig_widget
```

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):
Expand Down Expand Up @@ -180,17 +183,20 @@ and display plotly figures inline using the notebook renderer...


```python
import plotly.graph_objects as go
fig = go.Figure(data=go.Bar(y=[2, 3, 1]))
import plotly.express as px
fig = px.bar(x=["a", "b", "c"], y=[1, 3, 2])
fig.show()
```

or using `FigureWidget` objects.

```python
import plotly.express as px
fig = px.bar(x=["a", "b", "c"], y=[1, 3, 2])

import plotly.graph_objects as go
fig = go.FigureWidget(data=go.Bar(y=[2, 3, 1]))
fig
fig_widget = go.FigureWidget(fig)
fig_widget
```

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`.
Expand Down

0 comments on commit 4eed225

Please sign in to comment.