|
94 | 94 | "source": [ |
95 | 95 | "alt.Chart(surveys_complet).mark_line().encode(\n", |
96 | 96 | " x=alt.X('month').type('ordinal'),\n", |
97 | | - " y=alt.Y('weight').aggregate('median'),\n", |
| 97 | + " y=alt.Y('weight').aggregate('median').scale(type='log', base=2),\n", |
98 | 98 | " color=alt.Color('species_id'),\n", |
99 | | - " tooltip=['species_id'],\n", |
| 99 | + " tooltip=['species_id', 'median(weight)'],\n", |
100 | 100 | ")" |
101 | 101 | ] |
102 | 102 | }, |
|
161 | 161 | " x=alt.X('date'),\n", |
162 | 162 | " y=alt.Y('weight').aggregate('median'),\n", |
163 | 163 | " color=alt.Color('species_id'),\n", |
164 | | - " tooltip=['species_id', 'date'],\n", |
| 164 | + " tooltip=['species_id', 'date', 'median(weight)'],\n", |
165 | 165 | ")" |
166 | 166 | ] |
167 | 167 | }, |
|
178 | 178 | "* **Choix du type de marqueurs** à afficher\n", |
179 | 179 | " * `graphique.mark_line()`\n", |
180 | 180 | "* **Assigner des variables** à des canaux du graphique\n", |
181 | | - " * `graphique.encode(...)`\n", |
182 | | - " * Différents canaux :\n", |
183 | | - " * `y=alt.Y('count()')`\n", |
184 | | - " * `y=alt.Y('varY').aggregate('stat')`,\n", |
185 | | - " avec les statistiques `'mean'`, `'median'`, etc." |
| 181 | + " * `y=alt.Y('varY').aggregate('fonc_agg')`, avec une des [fonctions\n", |
| 182 | + " d'agrégation](https://altair-viz.github.io/user_guide/transform/aggregate.html#aggregation-functions) :\n", |
| 183 | + " * `'count'`, `'sum'`\n", |
| 184 | + " * `'mean'`, `'stdev'`, `'variance'`\n", |
| 185 | + " * `'min'`, `'q1'`, `'median'`, `'q3'`, `'max'`\n", |
| 186 | + " * Syntaxe courte : `y=alt.Y('fonc_agg(varY)')`" |
186 | 187 | ] |
187 | 188 | }, |
188 | 189 | { |
|
0 commit comments