In a rmarkdown document, it can normally show the plot generated by matplotlib
inline.
However, when it comes to the basemap generated by contextily
, there's no inline output:
```{r setup}
library(reticulate)
# conda_create("r-reticulate")
use_condaenv("r-reticulate")
```
```{python}
import contextily as cx
import geopandas
import rasterio
from rasterio.plot import show as rioshow
import matplotlib.pyplot as plt
data_url = "https://ndownloader.figshare.com/files/20232174"
db = geopandas.read_file(data_url)
```
```{python}
ax = db.plot(color="red", figsize=(9, 9))
cx.add_basemap(ax, crs=db.crs.to_string())
```
May I ask how to solve this issue? My python version is 3.10.4.
Your kind guidance is much appreciated!