根據帖子中提供的代碼和資料(從rayshader教程網站獲得),我收到如下所示的錯誤。
可能是什么原因造成的,如何解決?
錯誤:
Error in hillshade[, , 1] * scales::rescale(shadowmap, c(max_darken, 1)) :
non-conformable arrays
代碼:
library(tidyverse)
library(reshape2)
library(viridis)
library(rayshader)
measles = read_csv("https://tylermw.com/data/measles_country_2011_2019.csv")
melt_measles = reshape2::melt(measles, id.vars = c("Year", "Country", "Region", "ISO3"))
melt_measles$Month = melt_measles$variable
melt_measles$cases = melt_measles$value
# Plot
melt_measles %>%
group_by(Year, Month) %>%
summarize(totalcases = sum(cases,na.rm = TRUE)) %>%
mutate(totalcases = ifelse(Year == 2019 & !(Month %in% c("January","February","March")), NA, totalcases)) %>%
ggplot()
geom_tile(aes(x=Year, y=Month, fill=totalcases,color=totalcases),size=1,color="black")
scale_x_continuous("Year", expand=c(0,0), breaks = seq(2011,2019,1))
scale_y_discrete("Month", expand=c(0,0))
scale_fill_viridis("Total\nCases")
ggtitle("Reported Worldwide Measles Cases")
labs(caption = "Data Source: WHO")
theme(axis.text = element_text(size = 12),
title = element_text(size = 12,face="bold"),
panel.border= element_rect(size=2,color="black",fill=NA)) ->
measles_gg
plot_gg(measles_gg, multicore = TRUE, width = 6, height = 5.5, scale = 300,
background = "#afceff",shadowcolor = "#3a4f70")
uj5u.com熱心網友回復:
這是一個已知問題 <github.com/tylermorganwall/rayshader/issues/176>
我測驗過remotes::install_github("tylermorganwall/rayshader")

轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/537769.html
標籤:r图表2光线着色器
