Skip to content

Commit 684c76c

Browse files
committed
plotly.express
1 parent 96a8e42 commit 684c76c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

notebooks/bar-charts.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jupyter:
3434
permalink: python/bar-charts/
3535
thumbnail: thumbnail/bar.jpg
3636
title: Bar Charts | plotly
37+
v4upgrade: true
3738
---
3839

3940
### Bar chart with plotly express
@@ -43,7 +44,7 @@ Plotly express functions (here needs link to stable px doc entry) take as argume
4344
In a bar plot, each row of the DataFrame is represented as a rectangular mark.
4445

4546
```python
46-
import plotly_express as px
47+
import plotly.express as px
4748
data_canada = px.data.gapminder().query("country == 'Canada'")
4849
fig = px.bar(data_canada, x='year', y='pop')
4950
fig.show()
@@ -58,7 +59,7 @@ data_canada
5859
The bar plot can be customized using keyword arguments *TODO here link to meta doc page on customizing plotly plots?*.
5960

6061
```python
61-
import plotly_express as px
62+
import plotly.express as px
6263
data = px.data.gapminder()
6364

6465
data_canada = data[data.country == 'Canada']
@@ -71,14 +72,15 @@ fig.show()
7172
When several rows share the same value of `x` (here Female or Male), the rectangles are stacked on top of one another by default.
7273

7374
```python
74-
import plotly_express as px
75+
import plotly.express as px
7576
tips = px.data.tips()
7677
fig = px.bar(tips, x="sex", y="total_bill", color='time')
7778
fig.show()
7879
```
7980

8081
```python
8182
# Change the default stacking
83+
import plotly.express as px
8284
fig = px.bar(tips, x="sex", y="total_bill", color='smoker', barmode='group',
8385
height=400)
8486
fig.show()
@@ -89,6 +91,7 @@ fig.show()
8991
Use the keyword arguments `facet_row` (resp. `facet_col`) to create facetted subplots, where different rows (resp. columns) correspond to different values of the dataframe column specified in `facet_row`.
9092

9193
```python
94+
import plotly.express as px
9295
fig = px.bar(tips, x="sex", y="total_bill", color="smoker", barmode="group",
9396
facet_row="time", facet_col="day",
9497
category_orders={"day": ["Thur", "Fri", "Sat", "Sun"],

0 commit comments

Comments
 (0)