+ - 0:00:00
Notes for current slide
Notes for next slide

Data Visualization

Chapter 3. Data Visualization in R

Iñaki Úcar

Department of Statistics | uc3m-Santander Big Data Institute

Master in Computational Social Science

Licensed under Creative Commons Attribution CC BY 4.0 Last generated: 2025-01-16

1 / 11

Directory of Visualizations

Based on The R Graph Gallery

2 / 11

Other Resources

< Contents

Animation Interactive Caveats Data Art


3 / 11

Other Resources Animation

< Contents

ggplot(gapminder::gapminder) +
aes(gdpPercap, lifeExp) +
geom_point(aes(size=pop,
color=continent),
alpha=0.7) +
scale_size(range=c(2, 12), guide=NULL) +
scale_x_log10() +
theme(legend.position=c(1, 0),
legend.justification=c(1, 0)) +
gganimate::transition_time(year) +
gganimate::ease_aes("linear") +
labs(title="Year: {frame_time}")

4 / 11

Other Resources Interactivity

< Contents

ggplot(gapminder::gapminder) +
aes(gdpPercap, lifeExp) +
geom_point(aes(size=pop,
color=continent),
alpha=0.7) +
scale_size(range=c(2, 12), guide=NULL) +
scale_x_log10() +
theme_gray(base_size=10) +
aes(frame=year, text=country) -> p
plotly::ggplotly(p) |>
plotly::layout(legend=list(
x=1, y=0, xanchor="right"))
1e+031e+041e+05406080
continentAfricaAmericasAsiaEuropeOceania~year: 1952195219621972198219922002gdpPercaplifeExpPlay
5 / 11

Other Resources Caveats

< Contents

6 / 11

Other Resources Inspiration

< Contents

7 / 11

Other Resources Data Art

< Contents

8 / 11

Other Resources | Chart selection

< Contents

9 / 11

Other Resources | Chart selection

< Contents

10 / 11

Other Resources | Extensions

< Contents

11 / 11

Directory of Visualizations

Based on The R Graph Gallery

2 / 11
Paused

Help

Keyboard shortcuts

, , Pg Up, k Go to previous slide
, , Pg Dn, Space, j Go to next slide
Home Go to first slide
End Go to last slide
Number + Return Go to specific slide
b / m / f Toggle blackout / mirrored / fullscreen mode
c Clone slideshow
p Toggle presenter mode
t Restart the presentation timer
?, h Toggle this help
sToggle scribble toolbox
Esc Back to slideshow