Am working with a shapefile while doing my spatial data analysis when i try to use ggplot to plot the sapefile this is the error it throws
library(ggplot2)
lf<- fortify(ke_counties,region = "CONST_CODE")#Convert spatial data
head(lf)
p<- ggplot() +
geom_polygon(data=lf,
aes(x=long,y=lat,group=group,fill=order),#the order is the column in the data
color="black",size=0.25) +
coord_map()#this adds coordinates in the map
p
lf
The Error that coem up yet my data frame is okey
Error in .Call.graphics(C_palette2, .Call(C_palette2, NULL)) :
invalid graphics state