diff --git a/src/05-altair.ipynb b/src/05-altair.ipynb index 5e309b7..d43f9ab 100644 --- a/src/05-altair.ipynb +++ b/src/05-altair.ipynb @@ -552,6 +552,7 @@ "* Sur l'axe vertical, spécifiez `'count()'` comme variable pour que\n", " Altair fasse automatiquement le décompte, ce qui évite de passer\n", " par la méthode `groupby()` du DataFrame\n", + "* Activez le canal `tooltip` avec `'count()'` pour avoir le décompte\n", "\n", "(4 min.)" ] @@ -574,6 +575,7 @@ " [`'ordinal'` type](https://altair-viz.github.io/user_guide/encodings/#encoding-data-types)\n", "* For the Y axis, specify `'count()'` as a temporary field computed\n", " automatically by Altair, which saves us from using `groupby()`\n", + "* Activate the `tooltip` channel with `'count()'`\n", "\n", "(4 min.)" ] @@ -593,6 +595,7 @@ "alt.Chart(surveys_complet).mark_bar().encode(\n", " x=alt.X('plot_id').type('ordinal'),\n", " y=alt.Y('count()'),\n", + " tooltip=['count()'],\n", ")" ] }, @@ -611,6 +614,7 @@ "###(surveys_complet)###\n", " ###('plot_id').type('ordinal'),\n", " ###('count()'),\n", + " ###['count()'],\n", ")" ] }, @@ -629,6 +633,7 @@ "alt.Chart(surveys_complete).mark_bar().encode(\n", " x=alt.X('plot_id').type('ordinal'),\n", " y=alt.Y('count()'),\n", + " tooltip=['count()'],\n", ")" ] }, @@ -647,6 +652,7 @@ "###(surveys_complete)###\n", " ###('plot_id').type('ordinal'),\n", " ###('count()'),\n", + " ###['count()'],\n", ")" ] }, @@ -976,8 +982,7 @@ " `'sex'`. La méthode `.scale()` permet ensuite d'associer les valeurs\n", " de domaine `'F'` et `'M'` aux couleurs `'orange'` et `'green'`.\n", " Voir [un exemple ici](https://altair-viz.github.io/user_guide/customization.html#color-domain-and-range)\n", - "* Activez le canal `tooltip` avec `'count()'` pour avoir le décompte\n", - " par sexe\n", + "* Dans le canal `tooltip`, ajoutez `'sex'` au début de la liste\n", "\n", "(4 min.)" ] @@ -996,8 +1001,7 @@ " The `.scale()` method can then associate domain values `'F'`\n", " and `'M'` to colors `'orange'` and `'green'`, respectively.\n", " See [an example here](https://altair-viz.github.io/user_guide/customization.html#color-domain-and-range)\n", - "* Activate the `tooltip` channel with\n", - " `'count()'` in order to get the count by sex\n", + "* In the `tooltip` channel, add `'sex'` at the beginning of the list\n", "\n", "(4 min.)" ] @@ -1021,7 +1025,7 @@ " domain=['F', 'M'],\n", " range=['orange', 'green'],\n", " ),\n", - " tooltip=['count()'],\n", + " tooltip=['sex', 'count()'],\n", ")" ] }, @@ -1044,7 +1048,7 @@ " ###=['F', 'M'],\n", " ###=['orange', 'green'],\n", " ),\n", - " ###['count()'],\n", + " tooltip=[###, 'count()'],\n", ")" ] }, @@ -1067,7 +1071,7 @@ " domain=['F', 'M'],\n", " range=['orange', 'green'],\n", " ),\n", - " tooltip=['count()'],\n", + " tooltip=['sex', 'count()'],\n", ")" ] }, @@ -1090,7 +1094,7 @@ " ###=['F', 'M'],\n", " ###=['orange', 'green'],\n", " ),\n", - " ###['count()'],\n", + " tooltip=[###, 'count()'],\n", ")" ] },