使用ggmap将R转换为ggmap轴的功能,将DD转换为DMS

问题描述

我一直在使用以下代码在我的地图上将DD转换为DMS。

scale_x_longitude <- function(xmin=-180,xmax=180,step=1,...) {
  xbreaks <- seq(xmin,xmax,step)
  xlabels <- unlist(
    lapply(xbreaks,function(x){
      ifelse(x < 0,parse(text=paste0(paste0(abs(dms(x)$d),"^{o}*"),paste0(abs(dms(x)$m)),"*W")),ifelse(x > 0,"*E")),abs(dms(x))))}))
  return(scale_x_continuous("Longitude",breaks = xbreaks,labels = xlabels,expand = c(0,0),...))
}

scale_y_latitude <- function(ymin=-90,ymax=90,step=0.5,...) {
  ybreaks <- seq(ymin,ymax,step)
  ylabels <- unlist(
    lapply(ybreaks,"*S"),"*N")),abs(dms(x))))}))
  return(scale_y_continuous("Latitude",breaks = ybreaks,labels = ylabels,...))
}  

在这里Revisiting the "Format latitude and longitude axis labels in ggplot"

找到了它

但是至少四个月以来,这些功能不再起作用。我收到以下错误

Error in grid.Call(C_textBounds,as.graphicsAnnot(x$label),x$x,x$y,: 
  annotation mathématique incorrecte

注释数学不正确可以翻译为“数学表达式不正确”

有人可以帮助我吗?

您真诚的, 亚历山大

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)