0

I'm having a difficulty plotting a global map using Robinson projection. It used to work with no problem, but since I updated R studio with the newest version it keeps showing an error code like

"Error in `f()`: ! Not implemented"

So I tried with geom_sf. It shows up a global map with Robinson projection and a legend correctly but does not plot the actual data values. I assume the geometries between geom_sf and what's in my data (geom_tile) do not match.

I appreciate your help!

Map output:

code:

world <- fortify(getMap())

world <- sf::st_transform(
+ world,
+ "+proj=robin +lon_0=0 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs", ylim=c(-55,80),xlim=c(-180,180))


lengthmap_110_2050_MAM <- ggplot() 
+ geom_sf(data=world) 
+ theme_minimal()
+ geom_tile(data = length_110_2050_MAM,aes(X1, X2, fill = X4),alpha = 0.8)
+ scale_fill_gradient(low="yellow", high="Red")
+ xlab("Longitude") +ylab("Latitude") 
+ ggtitle("Days with PM2.5 > 110 in Mar-Apr-May")
+ theme(legend.key.width = unit(0.1, 'in'),legend.key.height = unit(0.7, 'in'),legend.position = 'right',plot.title = element_text(size=10))

length_110_2050_MAM is a data frame with X1 for longtidue, X2 for latitude, and X4 for the value I want to plot with.

head(length_110_2050_MAM)

enter image description here

Y Hur
  • 1
  • 1

0 Answers0