-
Notifications
You must be signed in to change notification settings - Fork 432
Expand file tree
/
Copy pathplotly.qmd
More file actions
56 lines (53 loc) · 1.91 KB
/
plotly.qmd
File metadata and controls
56 lines (53 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
---
title: "Bugged plotly figure: phantom subfigure"
_quarto:
tests:
html:
ensureHtmlElements:
-
- 'figure.quarto-float-fig div#fig-gapminder-1 figure.quarto-subfloat-fig div.plotly-graph-div'
- 'figure.quarto-float-fig div#fig-gapminder-2 figure.quarto-subfloat-fig div.plotly-graph-div'
ensureHtmlElementContents:
selectors:
- 'div#fig-gapminder-1 figcaption.quarto-subfloat-caption'
- 'div#fig-gapminder-2 figcaption.quarto-subfloat-caption'
matches: ['\((a|b)\) Gapminder: (1957|2007)']
ensureHtmlElementCount:
selectors: ['figure.quarto-float-fig figure.quarto-subfloat-fig']
counts: [2]
dashboard:
ensureHtmlElements:
-
- 'figure.quarto-float-fig div#fig-gapminder-1 figure.quarto-subfloat-fig div.plotly-graph-div'
- 'figure.quarto-float-fig div#fig-gapminder-2 figure.quarto-subfloat-fig div.plotly-graph-div'
ensureHtmlElementContents:
selectors:
- 'div#fig-gapminder-1 figcaption.quarto-subfloat-caption'
- 'div#fig-gapminder-2 figcaption.quarto-subfloat-caption'
matches: ['\((a|b)\) Gapminder: (1957|2007)']
ensureHtmlElementCount:
selectors: ['figure.quarto-float-fig figure.quarto-subfloat-fig']
counts: [2]
---
```{python}
#| label: fig-gapminder
#| fig-cap: "Life Expectancy and GDP"
#| fig-subcap:
#| - "Gapminder: 1957"
#| - "Gapminder: 2007"
#| layout-ncol: 2
#| column: page
import plotly.express as px
import plotly.io as pio
gapminder = px.data.gapminder()
def gapminder_plot(year):
gapminderYear = gapminder.query("year == " +
str(year))
fig = px.scatter(gapminderYear,
x="gdpPercap", y="lifeExp",
size="pop", size_max=60,
hover_name="country")
fig.show()
gapminder_plot(1957)
gapminder_plot(2007)
```