@@ -93,7 +93,7 @@ ggplot(data = gapminder, mapping = aes(x = gdpPercap, y = lifeExp)) +
9393 geom_point()
9494```
9595
96- <img src =" fig/08-plot-ggplot2-rendered-build-ggplot-3-1.png " style =" display : block ; margin : auto ;" />
96+ <img src =" fig/08-plot-ggplot2-rendered-build-ggplot-3-1.png " alt = " " style =" display : block ; margin : auto ;" />
9797
9898::::::::::::::::::::::::::::::::::::::: challenge
9999
@@ -124,7 +124,7 @@ Esta es una posible solución:
124124ggplot(data = gapminder , aes(x = year , y = lifeExp )) + geom_point()
125125```
126126
127- <img src =" fig/08-plot-ggplot2-rendered-ch1-sol-1.png " style =" display : block ; margin : auto ;" />
127+ <img src =" fig/08-plot-ggplot2-rendered-ch1-sol-1.png " alt = " " style =" display : block ; margin : auto ;" />
128128
129129:::::::::::::::::::::::::
130130
@@ -154,7 +154,7 @@ ggplot(data = gapminder, aes(x = year, y = lifeExp, color=continent)) +
154154 geom_point()
155155```
156156
157- <img src =" fig/08-plot-ggplot2-rendered-ch2-sol-1.png " style =" display : block ; margin : auto ;" />
157+ <img src =" fig/08-plot-ggplot2-rendered-ch2-sol-1.png " alt = " " style =" display : block ; margin : auto ;" />
158158
159159:::::::::::::::::::::::::
160160
@@ -171,7 +171,7 @@ ggplot(data = gapminder, aes(x=year, y=lifeExp, by=country, color=continent)) +
171171 geom_line()
172172```
173173
174- <img src =" fig/08-plot-ggplot2-rendered-lifeExp-line-1.png " style =" display : block ; margin : auto ;" />
174+ <img src =" fig/08-plot-ggplot2-rendered-lifeExp-line-1.png " alt = " " style =" display : block ; margin : auto ;" />
175175
176176En vez de agregar una capa ` geom_point ` , hemos agregado una capa ` geom_line ` .
177177Además, hemos agregado el argumento ** aesthetic** ** by** , el cual le dice a ` ggplot ` que
@@ -186,7 +186,7 @@ ggplot(data = gapminder, aes(x=year, y=lifeExp, by=country, color=continent)) +
186186 geom_line() + geom_point()
187187```
188188
189- <img src =" fig/08-plot-ggplot2-rendered-lifeExp-line-point-1.png " style =" display : block ; margin : auto ;" />
189+ <img src =" fig/08-plot-ggplot2-rendered-lifeExp-line-point-1.png " alt = " " style =" display : block ; margin : auto ;" />
190190
191191Es importante notar que cada capa se dibuja encima de la capa anterior. En este ejemplo,
192192los puntos se han dibujado * sobre* las líneas. A continuación observamos una demostración:
@@ -197,7 +197,7 @@ ggplot(data = gapminder, aes(x=year, y=lifeExp, by=country)) +
197197 geom_line(aes(color = continent )) + geom_point()
198198```
199199
200- <img src =" fig/08-plot-ggplot2-rendered-lifeExp-layer-example-1-1.png " style =" display : block ; margin : auto ;" />
200+ <img src =" fig/08-plot-ggplot2-rendered-lifeExp-layer-example-1-1.png " alt = " " style =" display : block ; margin : auto ;" />
201201
202202En este ejemplo, el mapeo ** aesthetic** de ** color** se ha movido de las opciones globales de la gráfica en
203203` ggplot ` a la capa ` geom_line ` y, por lo tanto, ya no es válido para los puntos.
@@ -236,7 +236,7 @@ ggplot(data = gapminder, aes(x=year, y=lifeExp, by=country)) +
236236 geom_point() + geom_line(aes(color = continent ))
237237```
238238
239- <img src =" fig/08-plot-ggplot2-rendered-ch3-sol-1.png " style =" display : block ; margin : auto ;" />
239+ <img src =" fig/08-plot-ggplot2-rendered-ch3-sol-1.png " alt = " " style =" display : block ; margin : auto ;" />
240240
241241¡Las líneas ahora están dibujadas sobre los puntos!
242242
@@ -255,7 +255,7 @@ ggplot(data = gapminder, aes(x = gdpPercap, y = lifeExp, color=continent)) +
255255 geom_point()
256256```
257257
258- <img src =" fig/08-plot-ggplot2-rendered-lifeExp-vs-gdpPercap-scatter3-1.png " style =" display : block ; margin : auto ;" />
258+ <img src =" fig/08-plot-ggplot2-rendered-lifeExp-vs-gdpPercap-scatter3-1.png " alt = " " style =" display : block ; margin : auto ;" />
259259
260260En este momento es difícil ver las relaciones entre los puntos debido a algunos
261261valores altamente atípicos de la variable GDP per capita. Podemos cambiar la escala de unidades del eje X
@@ -270,7 +270,7 @@ ggplot(data = gapminder, aes(x = gdpPercap, y = lifeExp)) +
270270 geom_point(alpha = 0.5 ) + scale_x_log10()
271271```
272272
273- <img src =" fig/08-plot-ggplot2-rendered-axis-scale-1.png " style =" display : block ; margin : auto ;" />
273+ <img src =" fig/08-plot-ggplot2-rendered-axis-scale-1.png " alt = " " style =" display : block ; margin : auto ;" />
274274
275275La función ` log10 ` aplica una transformación sobre los valores de la columna "gdpPercap"
276276antes de presentarlos en el gráfico, de manera que cada múltiplo de 10 ahora
@@ -304,7 +304,7 @@ ggplot(data = gapminder, aes(x = gdpPercap, y = lifeExp)) +
304304`geom_smooth()` using formula = 'y ~ x'
305305```
306306
307- <img src =" fig/08-plot-ggplot2-rendered-lm-fit-1.png " style =" display : block ; margin : auto ;" />
307+ <img src =" fig/08-plot-ggplot2-rendered-lm-fit-1.png " alt = " " style =" display : block ; margin : auto ;" />
308308
309309Podemos hacer la línea más gruesa * configurando* el argumento ** aesthetic** ** tamaño** en la capa ` geom_smooth ` :
310310
@@ -317,7 +317,7 @@ ggplot(data = gapminder, aes(x = gdpPercap, y = lifeExp)) +
317317``` warning
318318Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
319319ℹ Please use `linewidth` instead.
320- This warning is displayed once every 8 hours .
320+ This warning is displayed once per session .
321321Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
322322generated.
323323```
@@ -326,7 +326,7 @@ generated.
326326`geom_smooth()` using formula = 'y ~ x'
327327```
328328
329- <img src =" fig/08-plot-ggplot2-rendered-lm-fit2-1.png " style =" display : block ; margin : auto ;" />
329+ <img src =" fig/08-plot-ggplot2-rendered-lm-fit2-1.png " alt = " " style =" display : block ; margin : auto ;" />
330330
331331Existen dos formas en las que un * aesthetic* puede ser especificado. Aquí * configuramos* el
332332** aesthetic** ** tamaño** pasándolo como un argumento a ` geom_smooth ` . Previamente en la lección
@@ -359,7 +359,7 @@ ggplot(data = gapminder, aes(x = gdpPercap, y = lifeExp)) +
359359`geom_smooth()` using formula = 'y ~ x'
360360```
361361
362- <img src =" fig/08-plot-ggplot2-rendered-ch4a-sol-1.png " style =" display : block ; margin : auto ;" />
362+ <img src =" fig/08-plot-ggplot2-rendered-ch4a-sol-1.png " alt = " " style =" display : block ; margin : auto ;" />
363363
364364:::::::::::::::::::::::::
365365
@@ -396,7 +396,7 @@ geom_smooth(method="lm", size=1.5)
396396`geom_smooth()` using formula = 'y ~ x'
397397```
398398
399- <img src =" fig/08-plot-ggplot2-rendered-ch4b-sol-1.png " style =" display : block ; margin : auto ;" />
399+ <img src =" fig/08-plot-ggplot2-rendered-ch4b-sol-1.png " alt = " " style =" display : block ; margin : auto ;" />
400400
401401:::::::::::::::::::::::::
402402
@@ -429,7 +429,7 @@ ggplot(data = az.countries, aes(x = year, y = lifeExp, color=continent)) +
429429 geom_line() + facet_wrap( ~ country )
430430```
431431
432- <img src =" fig/08-plot-ggplot2-rendered-facet-1.png " style =" display : block ; margin : auto ;" />
432+ <img src =" fig/08-plot-ggplot2-rendered-facet-1.png " alt = " " style =" display : block ; margin : auto ;" />
433433
434434La capa ` facet_wrap ` toma una "fórmula" como argumento, lo cual se indica por el símbolo ` ~ ` .
435435Esto le dice a R que debe dibujar un panel para cada valor único de la columna "country"
@@ -461,7 +461,7 @@ ggplot(data = az.countries, aes(x = year, y = lifeExp, color=continent)) +
461461 theme(axis.text.x = element_blank(), axis.ticks.x = element_blank())
462462```
463463
464- <img src =" fig/08-plot-ggplot2-rendered-theme-1.png " style =" display : block ; margin : auto ;" />
464+ <img src =" fig/08-plot-ggplot2-rendered-theme-1.png " alt = " " style =" display : block ; margin : auto ;" />
465465
466466## Exportando una gráfica
467467
@@ -531,7 +531,7 @@ ggplot(data = gapminder, aes(x = gdpPercap, fill=continent)) +
531531 geom_density(alpha = 0.6 ) + facet_wrap( ~ year ) + scale_x_log10()
532532```
533533
534- <img src =" fig/08-plot-ggplot2-rendered-ch5-sol-1.png " style =" display : block ; margin : auto ;" />
534+ <img src =" fig/08-plot-ggplot2-rendered-ch5-sol-1.png " alt = " " style =" display : block ; margin : auto ;" />
535535
536536:::::::::::::::::::::::::
537537
0 commit comments