I created a flexdashboard using RMarkdown. I have gotten all but one of my graphics to work in the dashboard, but for the life of me I cannot get my gganimated map to work. It will run on its own, just not in the RMarkdown, flexdashboard template. I got the weirdest error code that makes no sense to me.
Below is my code and the error message. I appreciate your help!
mapData<- read_xlsx("State_AA_policies.xlsx") %>%
mutate(region = str_to_lower(region))
us <- map_data("state")
us<- us %>% left_join(mapData, by = "region") %>% drop_na(policies)
gg <-ggplot()
gg + geom_map(data=us, map=us, aes(x=long, y=lat, map_id=region, fill = policies), size=0.15) +
theme_classic() +
labs(x = NULL, y = NULL, color = "Legend") +
ggtitle("Nine States Banned Affirmative Action") +
theme(axis.ticks = element_blank()) +
theme(axis.text = element_blank())+
transition_manual(frames = region, cumulative = T)
cderv
May 12, 2022, 9:04am
2
I think the error comes from here in gganimate
error = function(e) {
warning('Cannot get dimensions of plot table. Plot region might not be fixed', call. = FALSE)
list(widths = NULL, heights = NULL)
}
)
dir <- tempfile(pattern = '')
dir.create(dir, showWarnings = FALSE)
files <- file.path(dir, sprintf('gganim_plot%04d', seq_along(frames)))
files <- switch(
tolower(device),
ragg_png = ,
png = paste0(files, '.png'),
jpg = ,
jpeg = paste0(files, '.jpg'),
tif = ,
tiff = paste0(files, '.tif'),
bmp = paste0(files, '.bmp'),
svglite = ,
svg = paste0(files, '.svg'),
current = files,
Can you share a full reproducible example ?
Also can you try in a regular Rmd without flexdashboard
?
Thanks
system
Closed
June 2, 2022, 9:04am
3
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed. If you have a query related to it or one of the replies, start a new topic and refer back with a link.