Skip to content

Commit

Permalink
docs: add constants to width and height (#8640)
Browse files Browse the repository at this point in the history
  • Loading branch information
raybellwaves authored Mar 13, 2024
1 parent c7b0204 commit 01b3f28
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions docs/index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,6 @@ t["species"].topk(num_species) # <2>

Ibis works with any Python plotting library that supports the [dataframe interchange protocol](https://data-apis.org/dataframe-protocol/latest/index.html).

```{python}
# | code-fold: true
width = 640 # <1>
height = 480 # <1>
```

1. Set the width and height of the plots.

```{python}
grouped = ( # <1>
t.group_by("species") # <1>
Expand Down Expand Up @@ -186,7 +178,7 @@ chart = (
y="count",
tooltip=["species", "count"],
)
.properties(width=width, height=height)
.properties(width=600, height=400)
.interactive()
)
chart
Expand All @@ -204,7 +196,7 @@ import matplotlib.pyplot as plt
chart = grouped.to_pandas().plot.bar(
x="species",
y="count",
figsize=(width / 100, height / 100),
figsize=(600 / 100, 400 / 100),
)
plt.show()
```
Expand All @@ -222,8 +214,8 @@ chart = px.bar(
grouped.to_pandas(),
x="species",
y="count",
width=width,
height=height,
width=600,
height=400,
)
chart
```
Expand All @@ -242,7 +234,7 @@ chart = (
aes(x="species", y="count"),
)
+ geom_bar(stat="identity")
+ theme(figure_size=(width / 100, height / 100))
+ theme(figure_size=(600 / 100, 400 / 100))
)
chart
```
Expand All @@ -261,7 +253,7 @@ chart = sns.barplot(
x="species",
y="count",
)
chart.figure.set_size_inches(width / 100, height / 100)
chart.figure.set_size_inches(600 / 100, 400 / 100)
```

:::
Expand Down

0 comments on commit 01b3f28

Please sign in to comment.