I am trying to do a seaborn heatmap plot via RStudio.
I usereticulate
package in R.
Below is my code:
library(reticulate)
use_condaenv("python36", conda = "auto", required = FALSE)
os <- import("os")
os$listdir(".")
py_available()
sns <- import('seaborn')
plt <- import('matplotlib.pyplot')
pd <- import('pandas')
dat <- AirPassengers
# convert time series to data frame
dat <- data.frame(matrix(dat, ncol=frequency(dat), dimnames=dimnames(.preformat.ts(dat)) ))
dat
sns$heatmap(r_to_py(dat), fmt = "g", cmap = "viridis")
plt$show()
However, I receive the following error and my R session gets aborted when it reaches the seaborn heatmap line. What should I do to fix this error?