1 comments

@stefan 2020-05-23 08:58:38

Format the labels via scales::number will do the trick:

library(ggplot2)
library(gganimate)
library(dplyr)

testp <- mydf %>% ggplot(aes(x = -ordering, y = Totals, fill = GEO)) +
  geom_col(width = 0.8, position = "identity") +
  coord_flip() +
  geom_text(aes(-ordering, y = 0, label = GEO, hjust = 0)) + # country label
  geom_text(aes(-ordering, y = Totals, label = scales::number(Totals, acc = 1), hjust = 0)) + # value label
  theme_minimal() +
  theme(legend.position = "none", axis.text.y = element_blank(), axis.ticks.y = element_blank())  +
  labs(
    y = "Offences per thousand inhabitants",
    x = "Countries", title = "Crime Data for European Countries {closest_state}"
  ) +
  transition_states(TIME, transition_length = 10, state_length = 14, wrap = FALSE)

testa <- testp +
  transition_states(TIME, transition_length = 10, state_length = 14, wrap = FALSE)

animate(testp,
   fps = 30, width = 600, height = 500, nframes = 10,
   start_pause = 30, end_pause = 30, renderer = gifski_renderer("gganim_test.gif")
)

enter image description here

Related Questions

Sponsored Content

8 Answered Questions

[SOLVED] Rotating and spacing axis labels in ggplot2

  • 2009-08-25 21:05:24
  • Christopher DuBois
  • 802470 View
  • 701 Score
  • 8 Answer
  • Tags:   r ggplot2 label

1 Answered Questions

[SOLVED] Change label of gganimate frame title

14 Answered Questions

[SOLVED] Order Bars in ggplot2 bar graph

  • 2011-03-06 04:20:48
  • Julio Diaz
  • 344984 View
  • 307 Score
  • 14 Answer
  • Tags:   r ggplot2 r-faq

1 Answered Questions

[SOLVED] How to animate grouped barplots with gganimate?

1 Answered Questions

[SOLVED] How to animate the axis label using `gganimate`?

  • 2019-04-27 08:32:28
  • Matthew Hui
  • 121 View
  • 0 Score
  • 1 Answer
  • Tags:   r ggplot2 gganimate

1 Answered Questions

1 Answered Questions

[SOLVED] Animated barplot via gganimate: Annotate box with changing text below plot

  • 2019-02-16 15:35:46
  • Joachim Schork
  • 937 View
  • 1 Score
  • 1 Answer
  • Tags:   r ggplot2 gganimate

2 Answered Questions

[SOLVED] ggplot2 + world map = old data?

  • 2013-01-21 19:54:18
  • Chris
  • 2315 View
  • 13 Score
  • 2 Answer
  • Tags:   r ggplot2

Sponsored Content